mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Ensure that typmod decoration on a datatype name is validated in all cases,
even in code paths where we don't pay any subsequent attention to the typmod value. This seems needed in view of the fact that 8.3's generalized typmod support will accept a lot of bogus syntax, such as "timestamp(foo)" or "record(int, 42)" --- if we allow such things to pass without comment, users will get confused. Per a recent example from Greg Stark. To implement this in a way that's not very vulnerable to future bugs-of-omission, refactor the API of parse_type.c's TypeName lookup routines so that typmod validation is folded into the base lookup operation. Callers can still choose not to receive the encoded typmod, but we'll check the decoration anyway if it's present.
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.424 2007/11/09 17:31:07 mha Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.425 2007/11/11 19:22:49 tgl Exp $
|
||||
*
|
||||
*--------------------------------------------------------------------
|
||||
*/
|
||||
@ -4872,11 +4872,13 @@ flatten_set_variable_args(const char *name, List *args)
|
||||
* to interval and back to normalize the value and account
|
||||
* for any typmod.
|
||||
*/
|
||||
Oid typoid;
|
||||
int32 typmod;
|
||||
Datum interval;
|
||||
char *intervalout;
|
||||
|
||||
typmod = typenameTypeMod(NULL, arg->typename, INTERVALOID);
|
||||
typoid = typenameTypeId(NULL, arg->typename, &typmod);
|
||||
Assert(typoid == INTERVALOID);
|
||||
|
||||
interval =
|
||||
DirectFunctionCall3(interval_in,
|
||||
|
Reference in New Issue
Block a user