From: | "Igor Neyman" <ineyman(at)perceptron(dot)com> |
---|---|
To: | "Guillaume Lelarge" <guillaume(at)lelarge(dot)info>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "Dino Vliet" <dino_vliet(at)yahoo(dot)com>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: can function arguments have the type tablename.columnname%TYPE? |
Date: | 2010-05-12 14:56:29 |
Message-ID: | F4C27E77F7A33E4CA98C19A9DC6722A205F44D0E@EXCHANGE.corp.perceptron.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> -----Original Message-----
> From: Guillaume Lelarge [mailto:guillaume(at)lelarge(dot)info]
> Sent: Tuesday, May 11, 2010 11:56 AM
> To: Tom Lane
> Cc: Dino Vliet; pgsql-general(at)postgresql(dot)org
> Subject: Re: can function arguments have the type
> tablename.columnname%TYPE?
>
> Le 11/05/2010 16:16, Tom Lane a écrit :
> > Guillaume Lelarge <guillaume(at)lelarge(dot)info> writes:
> >> Le 11/05/2010 10:28, Dino Vliet a écrit :
> >>> I'm writing a plpgsql function in pgadminIII and want to
> know if the arguments can have the following type:
> >>>
> >>> tablename.columnname%TYPE
> >
> >> No, this construct is only available *inside* a PL/pgsql function
> >> body
> >
> > That's incorrect: you can use it in a function declaration too.
> >
>
> Oh sure. With body, I meant the part between the two $$. But
> you're right, I should have said "inside the declare and body
> parts of a PL/pgsql function".
>
> > Not sure what the OP's problem is exactly --- it might be
> specific to
> > pgAdmin.
>
> IIUC, he means doing something like this:
>
> CREATE FUNCTION f1(arg1 table.column%TYPE ...
>
> Which, AFAICT, is not possible. And you can't do that with
> pgAdmin, but you can use the %TYPE in the declare and body
> parts in pgAdmin.
>
>
> --
> Guillaume.
> http://www.postgresqlfr.org
> http://dalibo.com
>
> --
> Sent via pgsql-general mailing list
> (pgsql-general(at)postgresql(dot)org) To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
Guillaume,
I'm not sure why are you instisting that:
> CREATE FUNCTION f1(arg1 table.column%TYPE ...
>
> Which, AFAICT, is not possible.
It is definetily possible, i.e:
CREATE OR REPLACE FUNCTION myMaxCycle(i_n_Cell_id GP_CELL.cell_id%TYPE)
RETURNS GP_CYCLE.cycle_date_time%TYPE
AS $$...
Works in my 8.2 PG.
Regards,
Igor Neyman
From | Date | Subject | |
---|---|---|---|
Next Message | Igor Neyman | 2010-05-12 15:10:53 | Re: Weird unique constraint |
Previous Message | Scott Marlowe | 2010-05-12 14:37:59 | Re: Server tries to connect without ssl support |