Re: plpgsql function question

From: John DeSoi <desoi(at)pgedit(dot)com>
To: A(dot) Kretschmer <andreas(dot)kretschmer(at)schollglas(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: plpgsql function question
Date: 2007-04-04 12:19:15
Message-ID: F345B309-CEDD-43E1-8D2A-A978AE22FE31@pgedit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

If you use a plpgsql function to select the row you want to validate,
it will make life much easier. Something like

...
$$
declare
my_row a_row_type;
is_ok integer;
begin
select into my_row * from a_row_type where ....
is_ok := my_a_validate(my_row);
return is_ok;
$$
...

On Apr 4, 2007, at 1:01 AM, A. Kretschmer wrote:

> Because your function expects one parameter of your new type, you have
> to CAST your data into this type:
>
>
>
> test=# select * from my_a((1, 'foo', current_date)::a);
> my_a
> ------
> 1
> (1 row)

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message ezequias 2007-04-04 12:36:02 CPU statistics
Previous Message Roger Tannous 2007-04-04 12:00:56 Generating dates prior to generate_series