Re: [SQL] Unknown values in int8 fields?

2001-07-15 Thread Stephan Szabo
Have you tried "where recno IS NULL"? - Original Message - From: "Chris Ruprecht" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, July 15, 2001 7:05 PM Subject: [SQL] Unknown values in int8 fields? > Hi Chris, > > When I load records with copy from ... And one of the fields (

RE: [SQL] Unknown values in int8 fields?

2001-07-15 Thread Robby Slaughter
I've not been following this too closely but it sounds like you are trying to COPY records from table A to table B, where the table B also includes a serial value. Here's an easy trick which I'm pretty sure will work: instead of using COPY use SELECT INTO. It's much slower but I think it will do

[SQL] Unknown values in int8 fields?

2001-07-15 Thread Chris Ruprecht
Hi Chris, When I load records with copy from ... And one of the fields (last one) is left empty, I want the default of nextval('sequence_table') to kick in - but it doesn't. Now, the field with a unique index on it stays blank. No big deal if I could go and say 'update rate set recno = nextval('

Re: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Tom Lane
"Josh Berkus" <[EMAIL PROTECTED]> writes: >> Hmm, I just realized that there's a bug here: let's say you have >> >> CREATE VIEW latest AS >> SELECT * FROM news ORDER BY story_timestamp DESC LIMIT 1; >> >> ie, this view gives you the latest news story. > Why, exactly, do we need to support ORDER

Re: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Josh Berkus
Tom, > Hmm, I just realized that there's a bug here: let's say you have > > CREATE VIEW latest AS > SELECT * FROM news ORDER BY story_timestamp DESC LIMIT 1; > > ie, this view gives you the latest news story. If you do > > SELECT * FROM latest WHERE story_text LIKE '%Joe Smith%'; > > what y

[SQL] ANNOUNCE: Updated PostgreSQL Notes

2001-07-15 Thread Richard Huxton
Finally got my act together and updated my PostgreSQL Notes. You can access them from http://techdocs.postgresql.org (another plug for Justin ;-) Changes include: - downloadable zipped version - short example of accessing PostgreSQL from PHP - short example of accessing PostgreSQL from Perl (Pg

Re: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Josh Berkus writes: >> Hey! I thought you couldn't do ORDER BY in views ... yet I just did. >> Is this a new thing, or am I just getting my Trasact-SQL and my >> PostgreSQL mixed up again? > I think it was allowed from 7.1 on to enable LIMIT in view

RE: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Robby Slaughter
Josh: You wondered: >What happens if I put an ORDER BY in a view, then call an ORDER BY in a >query, e.g.: > >CREATE VIEW test_view AS >SELECT client_name, city, zip FROM clients >WHERE zip IS NOT NULL >ORDER BY zip; > >SELECT * FROM test_view ORDER BY city; > >Does the second ORDER BY override

Re: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Josh Berkus
Pater, Robbie, Bruce, > > Hey! I thought you couldn't do ORDER BY in views ... yet I just > did. > > Is this a new thing, or am I just getting my Trasact-SQL and my > > PostgreSQL mixed up again? > > I think it was allowed from 7.1 on to enable LIMIT in views to work > sensibly. Makes sense.

Re: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Bruce Momjian
I think Tom fixed that in 7.1.X. That is why it now works. > Tom, Stephan, > > Hey! I thought you couldn't do ORDER BY in views ... yet I just did. > Is this a new thing, or am I just getting my Trasact-SQL and my > PostgreSQL mixed up again? > > -Josh > > > > __AGLIO DATABASE SOLUTIO

Re: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Peter Eisentraut
Josh Berkus writes: > Hey! I thought you couldn't do ORDER BY in views ... yet I just did. > Is this a new thing, or am I just getting my Trasact-SQL and my > PostgreSQL mixed up again? I think it was allowed from 7.1 on to enable LIMIT in views to work sensibly. -- Peter Eisentraut [EMAIL

RE: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Robby Slaughter
I think PostgreSQL allows you to do an ORDER BY in a view, but the real message is that it just doesn't make any sense. Remember that a view is just a "virtual table", not a query. If you "order by" as part of it's definition, there's no guarantee that the data will be orded when you SELECT FROM l

[SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Josh Berkus
Tom, Stephan, Hey! I thought you couldn't do ORDER BY in views ... yet I just did. Is this a new thing, or am I just getting my Trasact-SQL and my PostgreSQL mixed up again? -Josh __AGLIO DATABASE SOLUTIONS___ Josh Berkus C