Re: when does a function name get mapped to an OID?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fran Fabrizio <ffabrizio(at)mmrd(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: when does a function name get mapped to an OID?
Date: 2002-04-23 18:30:09
Message-ID: 8219.1019586609@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Fran Fabrizio <ffabrizio(at)mmrd(dot)com> writes:
> I was noticing that within one of the files, something like this is
> declared:

> drop function bar();
> drop function foo();
> create function foo() returns int4 as '
> select bar();
> ' language 'sql';
> create function bar() returns int4 as '
> select 1234;
> ' language 'sql';

> This loads into the db just fine.

It does?

regression=# create function foo() returns int4 as '
regression'# select bar();
regression'# ' language 'sql';
ERROR: Function 'bar()' does not exist
Unable to identify a function that satisfies the given argument types
You may need to add explicit typecasts

The SQL language differs from the other ones in that it tries to
syntax-check the function body at CREATE time. Perhaps this
inconsistency is not good, but that's how it's been for a long time.
You *can* get away with the above practice in the PL languages.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Cornelia Boenigk 2002-04-23 18:56:12 PostgreSQL and bytea
Previous Message Darren Ferguson 2002-04-23 18:24:17 Re: when does a function name get mapped to an OID?