Re: pg_dump of regression (again) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pg_dump of regression (again)
Date
Msg-id 14094.968946269@sss.pgh.pa.us
Whole thread Raw
In response to pg_dump of regression (again)  (Philip Warner <pjw@rhyme.com.au>)
Responses Re: pg_dump of regression (again)
List pgsql-hackers
Philip Warner <pjw@rhyme.com.au> writes:
> Continuing to try to use format_type to output all types, I get the
> following in the regression database:

> CREATE AGGREGATE newavg ( 
>    BASETYPE = integer, 
>    SFUNC = int4_accum, 
>    STYPE = "numeric[]", 
>    INITCOND = '{0,0,0}', 
>    FINALFUNC = numeric_avg
> );

> where the original source was:

> CREATE AGGREGATE newavg (
>    sfunc = int4_accum, basetype = int4, 
>    stype = _numeric,
>    finalfunc = numeric_avg,
>    initcond1 = '{0,0,0}'
> );

> The problem is the "numeric[]" type.

numeric[] is a correct display of the type (and more intelligible than
_numeric IMHO), but quoting it is not correct.  If you are feeding the
output of format_type through something that believes it's quoting a
single identifier, you are going to have lots of problems.  It looks
to me like format_type will supply quotes when needed, so you shouldn't
add more.

Unfortunately, this won't work anyway for CREATE AGGREGATE, because I'm
pretty sure the parser only accepts simple identifiers and literals as
arguments in the list of keyword = value items.  The type-declaration
parser isn't invoked here, mainly because the grammar doesn't know
anything about the semantics of the individual keyword items.  So you
have to give the raw type name, no fancy fandangoes ...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: Indexing of LIKE queries is broken in current sources
Next
From: Tom Lane
Date:
Subject: Re: Dumping views as views?