Hi Guys,

What's with this:

test=# create function foo() returns integer as 'select 1;' language
'sql';
CREATE FUNCTION
test=# create function foo2() returns "integer" as 'select 1;' language
'sql';
ERROR:  Type "integer" does not exist

Why can't you quote return types?  Isn't that inconsistent with the rest
of Postgres?  Also, what about user-defined types that have spaces,
japanese characters, etc.?

Noticed this while working on phpPgAdmin...

Chris


Sun, 11 May 2003 18:59:31 +0800 (WST)
Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Return type bug in functions
Christopher Kings-Lynne <chriskl@familyhealth.com.au> writes:
> test=# create function foo() returns integer as 'select 1;' language
> 'sql';
> CREATE FUNCTION
> test=# create function foo2() returns "integer" as 'select 1;' language
> 'sql';
> ERROR:  Type "integer" does not exist

> Why can't you quote return types?

Because "integer" is not the actual internal name of the type.

> Isn't that inconsistent with the rest of Postgres? 

No; you can't quote it anywhere else either.  Nor can you quote it in
the SQL standard: INTEGER is a key word, not an identifier.

			regards, tom lane


Sun, 11 May 2003 10:12:54 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Return type bug in functions 