Re: RfD: more powerful "any" types - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: RfD: more powerful "any" types
Date
Msg-id 20090909185027.GS4132@alvh.no-ip.org
Whole thread Raw
In response to Re: RfD: more powerful "any" types  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> Alvaro Herrera <alvherre@commandprompt.com> writes:
> > BTW does "any" match other pseudotypes?  Would I be able to pass a
> > cstring into "any"?  That would create a large security hole I think.
> 
> How so?  'Cause you can do that now with anyelement.

Hmm, it doesn't seem to be allowed?

alvherre=# create function anyelem2 (anyelement) returns int language plpgsql as $$ begin return 1; end $$;
CREATE FUNCTION
alvherre=# select anyelem2(textout('oh'));
ERROR:  PL/pgSQL functions cannot accept type cstring
CONTEXTO:  compilation of PL/pgSQL function "anyelem2" near line 0


(BTW I find it a bit funny that lines are counted from 0.  I never
noticed that before).


> cstring is only a pseudotype for historical reasons, anyway --- there's
> nothing about it now that's not a real type.  I think we just have it
> that way to discourage people from storing it in tables.

Wow, it has I/O functions and all.  Amazing, I wasn't aware of that.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: CTE bug?
Next
From: Stephen Frost
Date:
Subject: Re: More robust pg_hba.conf parsing/error logging