pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
LOOP?
2+ messages / 2 participants
[nested] [flat]

* LOOP?
@ 2005-02-17 16:59  Ray Madigan <ray@madigans.org>
  0 siblings, 1 reply; 2+ messages in thread

From: Ray Madigan @ 2005-02-17 16:59 UTC (permalink / raw)
  To: pgsql-sql

I am writing a trigger to inspect a row of a temporary table to determine if
the row has any null columns,  I will return as soon as I find a null
column.  I ran across this in the manual and It seems like I could use

The FOR-IN-EXECUTE statement is another way to iterate over rows:
[<<label>>]
FOR record_or_row IN EXECUTE text_expression LOOP
statements
END LOOP;

postgresql has a RECORD type which is an abstract row.

Does it have any fields to tell the length?

Does it have an accessor function like new.element(index};

I am trying to write a general function where from instance to instance the
columns in the record change.  If I can't do this I will have to create a
new function for each temporary table.

Is this possible or should I quit looking;

FOR record IN {something related to NEW } LOOP

END LOOP;





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: LOOP?
@ 2005-02-17 18:05  Richard Huxton <dev@archonet.com>
  parent: Ray Madigan <ray@madigans.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Richard Huxton @ 2005-02-17 18:05 UTC (permalink / raw)
  To: Ray Madigan <ray@madigans.org>; +Cc: pgsql-sql

Ray Madigan wrote:
> I am writing a trigger to inspect a row of a temporary table to determine if
> the row has any null columns,  I will return as soon as I find a null
> column.  I ran across this in the manual and It seems like I could use
> 
> The FOR-IN-EXECUTE statement is another way to iterate over rows:
> [<<label>>]
> FOR record_or_row IN EXECUTE text_expression LOOP
> statements
> END LOOP;
> 
> postgresql has a RECORD type which is an abstract row.
> 
> Does it have any fields to tell the length?
> 
> Does it have an accessor function like new.element(index};

Short answer - no to the above.

You'll not find what you want in plpgsql, perhaps look at pltcl or 
plperl for this sort of thing.

--
   Richard Huxton
   Archonet Ltd



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-02-17 18:05 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-02-17 16:59 LOOP? Ray Madigan <ray@madigans.org>
2005-02-17 18:05 ` Richard Huxton <dev@archonet.com>

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