Re: [HACKERS] create function bug? - Mailing list pgsql-hackers

From Brett McCormick
Subject Re: [HACKERS] create function bug?
Date
Msg-id 199802052114.NAA00578@abraxas.scene.com
Whole thread Raw
In response to Re: [HACKERS] create function bug?  (Brett McCormick <brett@work.chicken.org>)
List pgsql-hackers
After going over the grammer and function code, there's a little bit
of weirdness I see.  I don't know the correct terminology, but the
grammer for typname is a little odd.  in the first case (i.e. txname)
it does some type translating itself (flort => float8, decimal =>
integer, numeric => integer) before calling xlateSqlType, which does
the same thing, but with the following types: (int/integer => int4,
smalling => int2, real => float8, interval => timespan)

in the second case (SETOF txname), none of this pre-xlateSqlType
translating is done.

is it safe to assume someone put this code in the wrong place (not in
xlateSqlType so it would apply to all types)?  is the grammar the best
place for this "type aliasing"?  would it be safe to modify the create
function grammer to call xlateSqlType (so long as opaque does not get
aliased to anything? ;)

--brett

> On Thu, 5 February 1998, at 17:00:15, Ewan Mellor wrote:
>
> > Using a snapshot from two days ago on a i586-pc-linux-gnu using
> > linux-elf template:
> >
> > test=> create table test (t1 integer);
> > CREATE
> > test=> create function myfunc (integer) returns integer
> > test-> as 'select $1' language 'sql';
> > ERROR:  ProcedureCreate: arg type 'integer' is not defined
> > test=> create function myfunc(int4) returns int4
> > test-> as 'select $1' language 'sql';
> > CREATE
> >
> > I can use the integer type in tables, but not in functions.  Is this a
> > bug?
> >
> > Ewan Mellor.

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Profile of current backend
Next
From: PostgreSQL
Date:
Subject: Bug with char() type