[SQL] set return function is returning a single record, multiple times,how can i get all the records in the table( description inside )

2006-04-28 Thread Penchalaiah P.
Hi   Please spare some time to provide a solution for the described problem :   I am using set returning functions to return all the records from a table named  pss , But what I am getting is the first record is returned as many  times , the number of records present in the rank_mas

Re: [SQL] set return function is returning a single record, multiple times,how can i get all the records in the table( description inside )

2006-04-28 Thread A. Kretschmer
am 28.04.2006, um 16:14:10 +0530 mailte Penchalaiah P. folgendes: > 4) The following is the function that retrieves the records from pss : > > CREATE or replace FUNCTION ftoc9() RETURNS setof structrankmaster2 > LANGUAGE 'plpgsql' > > AS' DECLARE > rowdata pss%rowtype; > BEGIN for i in 1..

Re: [SQL] set return function is returning a single record, multiple

2006-04-28 Thread Alexis Paul Bertolini
CREATE or replace FUNCTION ftoc9() RETURNS setof structrankmaster2 LANGUAGE 'plpgsql' AS' DECLARE rowdata pss%rowtype; BEGIN for i in 1..3 loop select * into rowdata from pss ; return next rowdata ; end loop; return; end'; The query should be outside the loop, otherwise you are re

[SQL] Outer joins?

2006-04-28 Thread Emils
Hello! I am a longtime postgres user (started around 10 years ago), however, as for some years I've been using it mostly as administrator. Now that I have started a project and doing some SQL, I've come up something I don't believe is right. Maybe I am too rusty on my SQL - if so, please forgive

Re: [SQL] Outer joins?

2006-04-28 Thread Stephan Szabo
On Fri, 28 Apr 2006, Emils wrote: > I am trying to do simple self-joins. > > The table structure is: > > object_values > == > obj_id > att_id > value > > namely, each object can have arbitrary number of attributes each of > them with a value. > > What I want, is a simple table of objects w

Re: [SQL] set return function is returning a single record,

2006-04-28 Thread Ross Johnson
On Fri, 2006-04-28 at 12:56 +0200, A. Kretschmer wrote: > am 28.04.2006, um 16:14:10 +0530 mailte Penchalaiah P. folgendes: > > 4) The following is the function that retrieves the records from pss : > > > > CREATE or replace FUNCTION ftoc9() RETURNS setof structrankmaster2 > > LANGUAGE 'plpgsq

Re: [SQL] Outer joins?

2006-04-28 Thread Tom Lane
Emils <[EMAIL PROTECTED]> writes: > The table structure is: > object_values > == > obj_id > att_id > value > namely, each object can have arbitrary number of attributes each of > them with a value. > What I want, is a simple table of objects with some of their specific > attributes, the

Re: [SQL] LinkedList

2006-04-28 Thread Guy Fraser
On Thu, 2006-27-04 at 22:58 -0500, Ben K. wrote: > > I have a table that I created that implements a linked list. I am not an > > expert SQL developer and was wondering if there are known ways to traverse > > the linked lists. Any information that can point me in the direction to > > figure this

[SQL] Slightly confused error message

2006-04-28 Thread Markus Schaber
Hi, I just stumbled over a slightly confused error message: mydb=# select count(*),coverage_area from myschema.streets except select cd as coverage_area from countryref.disks group by streets.coverage_area; ERROR: column "streets.coverage_area" must appear in the GROUP BY clause or be used in an

Re: [SQL] Slightly confused error message

2006-04-28 Thread Tom Lane
Markus Schaber <[EMAIL PROTECTED]> writes: > I just stumbled over a slightly confused error message: > mydb=# select count(*),coverage_area from myschema.streets except select > cd as coverage_area from countryref.disks group by streets.coverage_area; > ERROR: column "streets.coverage_area" must

Re: [SQL] Slightly confused error message

2006-04-28 Thread Markus Schaber
Hi, Tom, Tom Lane wrote: >>I just stumbled over a slightly confused error message: > >>mydb=# select count(*),coverage_area from myschema.streets except select >>cd as coverage_area from countryref.disks group by streets.coverage_area; >>ERROR: column "streets.coverage_area" must appear in the

Re: [SQL] Slightly confused error message

2006-04-28 Thread Martin Marques
On Fri, 28 Apr 2006 12:07:04 -0400, Tom Lane <[EMAIL PROTECTED]> wrote: > Markus Schaber <[EMAIL PROTECTED]> writes: >> I just stumbled over a slightly confused error message: > >> mydb=# select count(*),coverage_area from myschema.streets except select >> cd as coverage_area from countryref.disk

Re: [SQL] Slightly confused error message

2006-04-28 Thread Tom Lane
Markus Schaber <[EMAIL PROTECTED]> writes: > Yes, and my question is whether it is easy and worth the effort. to add > that information (about the acutally offending subquery) to the message. I'm not sure about localizing the subquery per se, but it might be possible to add a syntax pointer to the

Re: [SQL] LinkedList

2006-04-28 Thread Ben K.
On Fri, 28 Apr 2006, Guy Fraser wrote: -- HEAD insert into linkedlist values(null,1,0); insert into linkedlist values(1,2,10); insert into linkedlist values(2,3,20); insert into linkedlist values(3,4,30); insert into linkedlist values(4,5,40); -- TAIL insert into linkedlist values(5,null,50);