Re: [GENERAL] change natural column order

2004-11-30 Thread Tino Wildenhain
Hi, Am Mittwoch, den 01.12.2004, 16:46 +1100 schrieb Russell Smith: > Regarding the "Natural Order" of columns. > > Why if we can delete a column from the middle of a table now, change the type > of that column to something totally different, eg text -> int. > Can we not move the order of the ro

Re: [GENERAL] change natural column order

2004-11-30 Thread Russell Smith
Regarding the "Natural Order" of columns. Why if we can delete a column from the middle of a table now, change the type of that column to something totally different, eg text -> int. Can we not move the order of the rows around, and when the new row is written to disk in the new arrangement. Or

Re: [GENERAL] change natural column order

2004-11-30 Thread Greg Stark
"Dann Corbit" <[EMAIL PROTECTED]> writes: > Putting "SELECT * FROM " into a compiled program using libpq or > ESQL is a code defect. Period. > > ALTER TABLE ADD COLUMN /* Most frequent defect maker for SELECT * */ Whatever are you talking about? I've never tried ESQL precisely because it

Re: [GENERAL] change natural column order

2004-11-30 Thread gnari
From: "Dann Corbit" <[EMAIL PROTECTED]> > From: "Steve Atkins" <[EMAIL PROTECTED]> > > > > Would you care to expand on why you think this... > > > > my $row = $dbh->selectrow_hashref("select * from $table"); > > print 'foo = ', $row{'foo'}; > > > > ...is inherently a a code defect? > Ther

Re: [GENERAL] change natural column order

2004-11-30 Thread Dann Corbit
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of gnari Sent: Tuesday, November 30, 2004 4:48 PM To: [EMAIL PROTECTED] Subject: Re: [GENERAL] change natural column order From: "Steve Atkins" <[EMAIL PROTECTED]> > > Would you car

Re: [GENERAL] change natural column order

2004-11-30 Thread gnari
From: "Steve Atkins" <[EMAIL PROTECTED]> > > Would you care to expand on why you think this... > > my $row = $dbh->selectrow_hashref("select * from $table"); > print 'foo = ', $row{'foo'}; > > ...is inherently a a code defect? because it does not work ? (you mean $row->{'foo'}) sorry, coul

Re: [GENERAL] change natural column order

2004-11-30 Thread Steve Atkins
On Tue, Nov 30, 2004 at 03:03:37PM -0800, Dann Corbit wrote: > Using "SELECT * FROM " from the PSQL prompt or any other > interactive tool is perfectly fine. > > Putting "SELECT * FROM " into a compiled program using libpq or > ESQL is a code defect. Period. This looks like misinformation, a

Re: [GENERAL] change natural column order

2004-11-30 Thread Dann Corbit
Using "SELECT * FROM " from the PSQL prompt or any other interactive tool is perfectly fine. Putting "SELECT * FROM " into a compiled program using libpq or ESQL is a code defect. Period. ALTER TABLE ADD COLUMN /* Most frequent defect maker for SELECT * */ ALTER TABLE DROP COL

Re: [GENERAL] change natural column order

2004-11-30 Thread Pierre-Frédéric Caillaud
> SELECT * is almost always bad style. It shouldnt be so hard to This is another religious issue you'll find people pretty adamant on both sides. Seems so. I tend to prefer to use "SELECT *" because it reduces repetition and improves modularity. There are fewer places in the code that need t

Re: [GENERAL] change natural column order

2004-11-30 Thread Greg Stark
Pierre-Frédéric Caillaud <[EMAIL PROTECTED]> writes: > > SELECT * is almost always bad style. It shouldnt be so hard to > > Why ? > > Many languages, including PHP, have associative arrays, so you should > just use array[column_name] instead of array[column_number]. This is what I

Re: [GENERAL] change natural column order

2004-11-30 Thread Mage
Tom Lane wrote: Richard Huxton <[EMAIL PROTECTED]> writes: I think you'll find you're out of luck. IIRC there was some discussion on the hackers list regarding a mapping layer that would let you re-order columns. I think the decision was "too much work for too small a gain". Yup, that wa

Re: [GENERAL] change natural column order

2004-11-30 Thread Tom Lane
Richard Huxton <[EMAIL PROTECTED]> writes: > I think you'll find you're out of luck. IIRC there was some discussion > on the hackers list regarding a mapping layer that would let you > re-order columns. I think the decision was "too much work for too small > a gain". Yup, that was exactly the c

Re: [GENERAL] change natural column order

2004-11-30 Thread Pierre-Frédéric Caillaud
SELECT * is almost always bad style. It shouldnt be so hard to Why ? Many languages, including PHP, have associative arrays, so you should just use array[column_name] instead of array[column_number]. This is what I do, all the time. For instance, in Python : * The wrong w

Re: [GENERAL] change natural column order

2004-11-30 Thread Joolz
Daniel Martini zei: > Hi, > > Joolz, you already got quite a few answers, that the frontend is > probably > not properly designed, if it relies on a certain column ordering. I > agree Hi Daniel, Well, I made the frontend myself, so... :) There is a reason that I made it this way, I have a datab

Re: [GENERAL] change natural column order

2004-11-30 Thread Mage
Tino Wildenhain wrote: Hi, Am Dienstag, den 30.11.2004, 10:26 +0100 schrieb Joolz: is it possible to change the natural order of the columns afterwards? The reason I need this is because the frontend picks up table columns in natural order, looks at the datatype and creates view, input and mutat

Re: [GENERAL] change natural column order

2004-11-30 Thread Daniel Martini
Hi, Joolz, you already got quite a few answers, that the frontend is probably not properly designed, if it relies on a certain column ordering. I agree completely with that. However your question got me curious, and I've digged around a bit in the system tables. You might be interested in my findi

Re: [GENERAL] change natural column order

2004-11-30 Thread Joolz
Richard Huxton zei: > Joolz wrote: >> >>>I dont think the overhead in implementing such a rarely needed >>>feature isnt worth it. We need a lot more other things ;-) >> >> >> I agree. Only I think this wouldn't require new functionality, I >> have a gut feeling that this is possible as it is. Now o

Re: [GENERAL] change natural column order

2004-11-30 Thread Richard Huxton
Joolz wrote: I dont think the overhead in implementing such a rarely needed feature isnt worth it. We need a lot more other things ;-) I agree. Only I think this wouldn't require new functionality, I have a gut feeling that this is possible as it is. Now only find out how :) I think you'll find y

Re: [GENERAL] change natural column order

2004-11-30 Thread Tino Wildenhain
Hi, Am Dienstag, den 30.11.2004, 11:31 +0100 schrieb Joolz: ... > > If you want to have a given ordering, why not just specify your > > column names in that order in your statements? Or just refer to > > them by column name if your host language allows it. > > The frondend functions are made so t

Re: [GENERAL] change natural column order

2004-11-30 Thread Joolz
Tino Wildenhain zei: > Hi, > > Am Dienstag, den 30.11.2004, 10:26 +0100 schrieb Joolz: >> Hello everyone, >> >> When I create a table and later on (say, because customers want to >> store extra info) add a column, like this: >> >> create table test (lastfield varchar); >> alter table test add c

Re: [GENERAL] change natural column order

2004-11-30 Thread Tino Wildenhain
Hi, Am Dienstag, den 30.11.2004, 10:26 +0100 schrieb Joolz: > Hello everyone, > > When I create a table and later on (say, because customers want to > store extra info) add a column, like this: > > create table test (lastfield varchar); > alter table test add column firstfield varchar; > >