Re: [SQL] Error: could not find pathkey item to sort

2008-04-21 Thread Tom Lane
Theerasak Maneeneim <[EMAIL PROTECTED]> writes: >I had some problem with postgresql 8.3.1. I had got an error > message, ERROR: could not find pathkey item to sort, when > I use this query statement: >SELECT INTO wk_fcstrec_dt DISTINCT MAX(fcstrec_dt) > FROM a_cus

Re: [SQL] Having a mental block with (self) outer joins

2008-04-21 Thread Thomas Kellerer
hubert depesz lubaczewski, 21.04.2008 16:05: ROOT, 1, NULL CHILD1, 2, 1 CHILD2, 3, 1 I would have expected the following result: ROOT, NULL ROOT, CHILD1 ROOT, CHILD2 but the row with (ROOT,NULL) is not returned. why would you expect it? the columns are: parent and child (on your output). yo

Re: [SQL] Having a mental block with (self) outer joins

2008-04-21 Thread hubert depesz lubaczewski
On Mon, Apr 21, 2008 at 03:48:23PM +0200, Thomas Kellerer wrote: > name, id, parent_id > ROOT, 1, NULL > CHILD1, 2, 1 > CHILD2, 3, 1 > > I would have expected the following result: > > ROOT, NULL > ROOT, CHILD1 > ROOT, CHILD2 > > but the row with (ROOT,NULL) is not returned. why would you expe

[SQL] Having a mental block with (self) outer joins

2008-04-21 Thread Thomas Kellerer
Hi, I'm playing around with putting a hierarchy of items into the database. But for some reason I'm having a mental block understanding the following: I have a table category with id and parent_id implementing the typical adjacency model. To get the first two levels of the hierarchy I use:

Re: [SQL] Desc Commnad in pgsql?

2008-04-21 Thread Alvaro Herrera
TJ O'Donnell wrote: > I like the table and other info from psql > and find I sometimes need that info in my client programs. > Are there any SQL/plpgsql functions that are analogous > to the psql \dt, \ds, etc. commands? If you start psql with the -E option it will show you the queries it used to