pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John DeSoi <desoi@pgedit.com>
To: A. Kretschmer <andreas.kretschmer@schollglas.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: plpgsql function question
Date: Wed, 4 Apr 2007 08:19:15 -0400
Message-ID: <F345B309-CEDD-43E1-8D2A-A978AE22FE31@pgedit.com> (raw)
In-Reply-To: <20070404050116.GA27391@a-kretschmer.de>
References: <BAY131-W2E4CDE0440527D94EA604B0670@phx.gbl>
	<20070404050116.GA27391@a-kretschmer.de>

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




view thread (7+ messages)

Message-ID: <F345B309-CEDD-43E1-8D2A-A978AE22FE31@pgedit.com>
Permalink:  ../F345B309-CEDD-43E1-8D2A-A978AE22FE31@pgedit.com/
Also on:    postgresql.org/message-id/F345B309-CEDD-43E1-8D2A-A978AE22FE31@pgedit.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: desoi@pgedit.com, andreas.kretschmer@schollglas.com
  Subject: Re: plpgsql function question
  In-Reply-To: <F345B309-CEDD-43E1-8D2A-A978AE22FE31@pgedit.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox