Understanding 8.4 new WITH syntax

Started by Richard Broersmaover 17 years ago4 messagesgeneral
Jump to latest
#1Richard Broersma
richard.broersma@gmail.com

I've seen a few examples about 8.4 Implementation of WITH syntax.

However, I don't fully understand how the various parts of this kind
of query work together as a whole. Does anyone know of any good
resources that explain it well?

--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

#2Grzegorz Jaśkiewicz
gryzman@gmail.com
In reply to: Richard Broersma (#1)
Re: Understanding 8.4 new WITH syntax

On Wed, Oct 8, 2008 at 4:31 PM, Richard Broersma <richard.broersma@gmail.com

wrote:

I've seen a few examples about 8.4 Implementation of WITH syntax.

However, I don't fully understand how the various parts of this kind
of query work together as a whole. Does anyone know of any good
resources that explain it well?

http://developer.postgresql.org/pgdocs/postgres/queries-with.html
is the way to go.
Try writing some stuff, to understand it. Otherwise you can read as much as
you wish.
Also, you can try to read our colleague's blog:

http://www.depesz.com/index.php/2008/10/07/waiting-for-84-common-table-expressions-with-queries/

#3Noname
cyw@dls.net
In reply to: Richard Broersma (#1)
PL/PGSQL CURSOR looping/iteration - PG 8.3

I see some proposal for implementing FOR loop for cursor in PG 8.4, but I could not found documentaion on how to loop or iterate thru a cursor in PG 8.3 or earler versions?

I guess I could do a FOR loop if I know the size of a cursor? How to find the size of a cursor?

Thanks,
CYW

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Noname (#3)
Re: PL/PGSQL CURSOR looping/iteration - PG 8.3

<cyw@dls.net> writes:

I see some proposal for implementing FOR loop for cursor in PG 8.4, but I could not found documentaion on how to loop or iterate thru a cursor in PG 8.3 or earler versions?

LOOP
FETCH ...;
EXIT WHEN NOT FOUND;
...
END LOOP;

regards, tom lane