Re: [GENERAL] pg_attribute.attnum - wrong column ordinal?

2009-12-05 Thread Peter Eisentraut
On tor, 2009-12-03 at 10:09 -0500, Tom Lane wrote: Alvaro Herrera alvhe...@commandprompt.com writes: Should we recast the attributes and columns views in information_schema? I notice they still use attnum. I'd vote against it, at least until we have something better than a row_number

Re: [GENERAL] pg_attribute.attnum - wrong column ordinal?

2009-12-03 Thread Alvaro Herrera
Greg Stark escribió: On Wed, Nov 25, 2009 at 1:03 AM, Konstantin Izmailov pgf...@gmail.com wrote: My question: can pg_attribute.attnum be used to determine the sequential ordinal positions of columns in a table? What is a right way to get the ordinal numbers? You could use something

Re: [GENERAL] pg_attribute.attnum - wrong column ordinal?

2009-12-03 Thread Tom Lane
Alvaro Herrera alvhe...@commandprompt.com writes: Should we recast the attributes and columns views in information_schema? I notice they still use attnum. I'd vote against it, at least until we have something better than a row_number solution. That would create another huge performance penalty

[GENERAL] pg_attribute.attnum - wrong column ordinal?

2009-11-24 Thread Konstantin Izmailov
Today I was contacted by a Microsoft (!) developer Kamil who was working on issues in Linked Servers to PostgreSQL. He brought the following scenario: if a column is dropped then ordinal positions of remaining columns are reported incorrectly. Here is test scenario: 1) create a table in PGAdmin:

Re: [GENERAL] pg_attribute.attnum - wrong column ordinal?

2009-11-24 Thread Greg Stark
On Wed, Nov 25, 2009 at 1:03 AM, Konstantin Izmailov pgf...@gmail.com wrote: My question: can pg_attribute.attnum be used to determine the sequential ordinal positions of columns in a table? What is a right way to get the ordinal numbers? You could use something like: row_number() over

Re: [GENERAL] pg_attribute.attnum - wrong column ordinal?

2009-11-24 Thread Konstantin Izmailov
Greg, this is brilliant - thank you very much! Is partition by compatible to PostgreSQL 8.0/8.2? I could not find compatibility information. It works fine with PG 8.3/8.4 and Greenplum 3.3 thou. Konstantin On Tue, Nov 24, 2009 at 6:30 PM, Greg Stark gsst...@mit.edu wrote: On Wed, Nov 25, 2009

Re: [GENERAL] pg_attribute.attnum - wrong column ordinal?

2009-11-24 Thread Greg Stark
On Wed, Nov 25, 2009 at 2:00 AM, Konstantin Izmailov pgf...@gmail.com wrote: Greg, this is brilliant - thank you very much! Is partition by compatible to PostgreSQL 8.0/8.2? I could not find compatibility information. It works fine with PG 8.3/8.4 and Greenplum 3.3 thou. It's 8.4 only. You

Re: [GENERAL] pg_attribute.attnum - wrong column ordinal?

2009-11-24 Thread Konstantin Izmailov
Oops, the server that I thought was 8.3 was recently upgraded to 8.4. I'm going to generate the ordinals on the client then. The nature of the query is that it can request columns information for all or several tables as well. The ordinals generation algorithm can reset counter to 1 each time the