Re: [SQL] How to select and result row number??

2002-09-17 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: >> Say what? Given the ORDER BY in the subselect, it will. > When you specify a table in FROM, there is no ordering to the table. Is > it guaranteed that a subquery in FROM _does_ have an ordering. If you write ORDER BY, we'll implement it. > Does ANS

Re: [SQL] cannot delete bug

2002-09-17 Thread Tom Lane
Kemin Zhou <[EMAIL PROTECTED]> writes: > kzdb=# select id from mytable where id=7224; > id > -- > 7224 > (1 row) > kzdb=# delete from mytable where id=7224; > ERROR: Relation 41073353 does not exist Have you got any rules, triggers, or foreign keys linking to or from that table?

Re: [SQL] How to select and result row number??

2002-09-17 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > >>> select nextval('temp_counter'), * from (select order by ...); > >> > >> Approximately the same solution, but without saving the result in a temp > >> table. > > > I thought about doing it this way. However, a subselect as a

Re: [SQL] How to select and result row number??

2002-09-17 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: >>> select nextval('temp_counter'), * from (select order by ...); >> >> Approximately the same solution, but without saving the result in a temp >> table. > I thought about doing it this way. However, a subselect as a > pseudotable is not guarantee

Re: [SQL] How to select and result row number??

2002-09-17 Thread Bruce Momjian
Ross J. Reedstrom wrote: > On Mon, Sep 16, 2002 at 11:12:06PM -0400, Bruce Momjian wrote: > > Yudie wrote: > > > > Good question. The only easy answer I have is the creation of a temp > > table with a SERIAL column: > > > > CREATE TEMP TABLE out (cnt SERIAL, other_cols...); > > INSERT

[SQL] cannot delete bug

2002-09-17 Thread Kemin Zhou
Dear Friends, I am not sure this due to my hardware problem or due to a bug in the postgres 7.2. kzdb=# select id from mytable where id=7224; id -- 7224 (1 row) kzdb=# delete from mytable where id=7224; ERROR: Relation 41073353 does not exist kzdb=# My simple solution is to dump the ta

Re: [SQL] Returning a reference to a cursor from a function

2002-09-17 Thread Richard Huxton
On Thursday 12 Sep 2002 7:12 pm, david williams wrote: > To anyone who can help me, > > I am new at Postgresql and am having some problems. > I went a stage further attempt to put this query into a function as such > CREATE FUNCTION getallusers() RETURN integer AS' > DECLARE > Liahona CURSOR

Re: [SQL] How to select and result row number??

2002-09-17 Thread Tom Lane
"Ross J. Reedstrom" <[EMAIL PROTECTED]> writes: > Hmm, with the new dependency code, is the auto-sequence from a SERIAL > in a temp table also a temp sequence? It get's put in the temp schema, > right? Seems we have a workaround for those wanting numbered result > sets. That's the hard way; just

Re: [SQL] How to select and result row number??

2002-09-17 Thread Ross J. Reedstrom
On Mon, Sep 16, 2002 at 11:12:06PM -0400, Bruce Momjian wrote: > Yudie wrote: > Good question. The only easy answer I have is the creation of a temp > table with a SERIAL column: > > CREATE TEMP TABLE out (cnt SERIAL, other_cols...); > INSERT INTO out SELECT ... ORDER BY col; Hmm,

[SQL] Join Question

2002-09-17 Thread Robert J. Sanford, Jr.
My office is working on a fantasy football database and, unfortunately, I have been tagged as the DBA. I'm a bit weak on set theory but I'm trying. Right now I am trying to calculate up game scores into the database rather than running through code to do that. A baseline of my schema is that: + E

Re: [SQL] How to select and result row number??

2002-09-17 Thread Roland Roberts
> "Yudie" == Yudie <[EMAIL PROTECTED]> writes: Yudie> what is the select statement so I can get result records like this Yudie> no cityname Yudie> -- Yudie> 1 NEW YORK Yudie> 2 LOS ANGELES Yudie> 3 HOUSTON Yudie> 4 Yud

Re: [SQL] Dublicates pairs in a table.

2002-09-17 Thread Richard Huxton
On Tuesday 17 Sep 2002 7:36 am, Ries van Twisk wrote: > Richard, > > do you suggest using a stored procedure to handle this? I do expect that > the table will be large (for me large is a around 1-2 records, the > table as more columns but I only need the restriction on c1 & c2) but I > don