Re: [SQL] JOIN not being calculated correctly

2004-11-20 Thread Tom Lane
"Scott Pederick" <[EMAIL PROTECTED]> writes: > Still can't fathom why it's not using an index scan on the jobs table.. Why exactly do you think that would make it faster? The query evidently requires visiting every single jobs row, so a seqscan seems appropriate to me; indeed I'd say the planner

Re: [SQL] JOIN not being calculated correctly

2004-11-20 Thread Scott Pederick
Hi Andrew, Thanks for your response - sorry it's taken so long to reply, I've been out of contact for a while. Still can't fathom why it's not using an index scan on the jobs table.. : Posting the EXPLAIN is a good, an EXPLAIN ANALYZE would be better : (assuming your dataset is small enough for

Re: [SQL] How to get the max on a char column?

2004-11-20 Thread Rodrigo Carvalhaes
Dear Jeff, Thank you for your help. I tried : select max((id::text)::integer) from test; and works perfectly! Greetings from Brazil! Rodrigo Carvalhaes Jeff Eckermann wrote: --- Rodrigo Carvalhaes <[EMAIL PROTECTED]> wrote: Hi ! I am quite confused of the results on a SELECT max... My environ

Re: [SQL] How to get the max on a char column?

2004-11-20 Thread Jeff Eckermann
--- Rodrigo Carvalhaes <[EMAIL PROTECTED]> wrote: > Hi ! > > I am quite confused of the results on a SELECT > max... > > My environment: > Conectiva Linux 10, PostgreSQL 7.4.6 (compiled from > the sources) > > My problem is the "select max(id) FROM test" the > result is 20 but the > right is 1

[SQL] How to get the max on a char column?

2004-11-20 Thread Rodrigo Carvalhaes
Hi ! I am quite confused of the results on a SELECT max... My environment: Conectiva Linux 10, PostgreSQL 7.4.6 (compiled from the sources) My problem is the "select max(id) FROM test" the result is 20 but the right is 1020. Is this a BUG or I am crazy ?? Cheers, Rodrigo Carvalhaes The SQL... tes

Re: [SQL] Move table between schemas

2004-11-20 Thread Tom Lane
Markus Schaber <[EMAIL PROTECTED]> writes: > Andrew Sullivan <[EMAIL PROTECTED]> wrote: >> CREATE TABLE newschema.newtable AS SELECT * FROM oldschema.oldtable >> oughta work. > - The operation is not atomic, thus there may be inserts and updates > into the old table that get lost while the "CREAT

Re: [SQL] Move table between schemas

2004-11-20 Thread Markus Schaber
Hi, Andrew, On Tue, 16 Nov 2004 06:05:38 -0500 Andrew Sullivan <[EMAIL PROTECTED]> wrote: > > Is there an easy way to move a table to another schema in PostgreSQL 7.4? > > > > ALTER TABLE and ALTER SCHEMA don't have this options. > > CREATE TABLE newschema.newtable AS SELECT * FROM oldschema.ol

Re: [SQL] get sequence value of insert command

2004-11-20 Thread Erik Thiele
On Fri, 19 Nov 2004 10:57:12 -0500 "Passynkov, Vadim" <[EMAIL PROTECTED]> wrote: > > -Original Message- > > From: Erik Thiele [mailto:[EMAIL PROTECTED] > > Sent: Friday, November 19, 2004 3:42 AM > > To: [EMAIL PROTECTED] > > Subject: [SQL] get sequence value of insert command > > > > cre