Re: logical column ordering

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: logical column ordering
Date: 2015-02-27 23:27:43
Message-ID: 1425079663038-5839828.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David G Johnston wrote
>
> Tomas Vondra-4 wrote
>> But if we want to allow users to define this, I'd say let's make that
>> part of CREATE TABLE, i.e. the order of columns defines logical order,
>> and you use something like 'AFTER' to specify physical order.
>>
>> CREATE TABLE test (
>> a INT AFTER b, -- attlognum = 1, attphysnum = 2
>> b INT -- attlognum = 2, attphysnum = 1
>> );
> Why not memorialize this as a storage parameter?
>
> CREATE TABLE test (
> a INT, b INT
> )
> WITH (layout = 'b, a')
> ;
>
> A canonical form should be defined and then ALTER TABLE can either
> directly update the current value or require the user to specify a new
> layout before it will perform the alteration.
>
> David J.

Extending the idea a bit further why not have "CREATE TABLE" be the API; or
at least something similar to it?

CREATE OR REARRANGE TABLE test (
[...]
)
WITH ();

The "[...]" part would be logical and the WITH() would define the physical.
The "PK" would simply be whatever is required to make the command work.

David J.

--
View this message in context: http://postgresql.nabble.com/logical-column-ordering-tp5829775p5839828.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2015-02-27 23:44:55 Re: pgsql: Invent a memory context reset/delete callback mechanism.
Previous Message Josh Berkus 2015-02-27 23:21:30 Re: logical column ordering