Re: Happy column adding and dropping
Don Baccus <dhogaza@pacifier.com>
From: Don Baccus <dhogaza@pacifier.com>
To: "Ross J. Reedstrom" <reedstrm@wallace.ece.rice.edu>
Cc: PostgreSQL Development <pgsql-hackers@postgreSQL.org>
Date: 2000-01-25T21:57:15Z
Lists: pgsql-hackers
At 03:48 PM 1/25/00 -0600, Ross J. Reedstrom wrote: > http://wallace.ece.rice.edu/sql1992.txt.gz Thanks! Now I have my own copy... ... >> Does the standard give a way to access the ordinal position of >> columns? > >You mean go from <column name> to <ordinal>? I don't think so, but I >haven't grovelled through the standard enough... O.K., now I have. It's >in the defined system tables, in particular the COLUMNS table, which I >won't duplicate here, since it runs to more than a printed page! It's >in clause 21.3.10, page 580, and defines a table that includes fields > >[...] > TABLE_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER, > COLUMN_NAME INFORMATION_SCHEMA.SQL_IDENTIFIER, > ORDINAL_POSITION INFORMATION_SCHEMA.CARDINAL_NUMBER > CONSTRAINT COLUMN_POSITION_NOT_NULL NOT NULL, >[...] > >So, yes, there is a standard way to get from <table name> + <ordinal> to ><column name>, if that's what you meant (since getting at the _contents_ >is trivial: SELECT <ordinal> from <table name> Gack, look what you've >done, I'm starting to type in <standard complient markup> ;-) OK, I asked because someone earlier said that Postgres should probably eventually provide SQL92 standard ways to get at table information. Interesting... - Don Baccus, Portland OR <dhogaza@pacifier.com> Nature photos, on-line guides, Pacific Northwest Rare Bird Alert Service and other goodies at http://donb.photo.net.