Re: alter table add column - specify where the column will go? - Mailing list pgsql-general

From Peter Bex
Subject Re: alter table add column - specify where the column will go?
Date
Msg-id 20101124103244.GC19975@frohike.homeunix.org
Whole thread Raw
In response to Re: alter table add column - specify where the column will go?  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Responses Re: alter table add column - specify where the column will go?  (Stuart McGraw <smcg2297@frii.com>)
List pgsql-general
On Wed, Nov 24, 2010 at 09:37:02AM +0000, Grzegorz Jaśkiewicz wrote:
> just never use SELECT *, but always call columns by names. You'll
> avoid having to depend on the order of columns, which is never
> guaranteed, even if the table on disk is one order, the return columns
> could be in some other.

People have been saying that on this list forever, and I agree you
shouldn't *depend* on column order, but why does INSERT syntax allow
you to omit the column names?

INSERT INTO sometable VALUES (1, 2, 3);

If columns inherently don't have an ordering, this shouldn't be
possible because it would make no sense.

Things like this INSERT syntax and the fact that columns are always
returned in the same order when you "SELECT *" or when you check the
table definition with \d condition people to expect being able to
influence the order of columns.

Cheers,
Peter
--
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                            -- Donald Knuth

pgsql-general by date:

Previous
From: Robert Gravsjö
Date:
Subject: Re: Debug advice when postgres connection maxing out
Next
From: AI Rumman
Date:
Subject: FTS is taking "
Get in touch!



© Postgres Professional Europe Limited, 2015 — 2024
EULA EULA for Cloud Environments Privacy Policy GDPR Compliance Commitment
© Postgres Professional Europe Limited, 2015 — 2024
EULA
EULA for Cloud Environments
Privacy Policy
GDPR Compliance Commitment