Re: SET NULL / SET NOT NULL

From: peter(at)helpnet_BUT_NOT_SPAM(dot)com(dot)au
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: SET NULL / SET NOT NULL
Date: 2002-02-22 03:37:15
Message-ID: ibeb7ucv1thngi3k4f8v4cjcn8vv2t0258@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

My 2.2c worth (0.2c GST included):
The MySQL approach is a pain because it effectively makes you define a
field from scratch. You have to know and include all the field
attributes instead of just changing the attribute you want.

The attribute definition should be the same as used in create.

If the SQL standard does not have an appropriate facility, submit
yours as an enhancement. They can only say yes, no, or that they have
something already in the pipeline and then you can implement their
proposed standard.

Peter

On Thu, 21 Feb 2002 01:15:15 +0000 (UTC), chriskl(at)familyhealth(dot)com(dot)au
("Christopher Kings-Lynne") wrote:

>Hi guys,
>
>I've been chatting to Tom about implementing the ability to change the NULL
>status of a column via SQL.
>
>This is the Oracle syntax:
>
>alter table table_name modify column1 not null;
>alter table table_name modify column1 null;
>
>This is the MySQL syntax:
>
>ALTER TABLE asfd CHANGE [COLUMN] old_col_name create_definition [FIRST |
>AFTER column_name]
>or ALTER TABLE asfd MODIFY [COLUMN] create_definition [FIRST | AFTER
>column_name]
>
>CHANGE col_name, DROP col_name, and DROP INDEX are MySQL extensions to ANSI
>SQL92.
>MODIFY is an Oracle extension to ALTER TABLE.
>
>So, the question is - what the heck is the standard syntax? Is there a
>standard syntax? How about this syntax that I came up with:
>
>ALTER TABLE blah ALTER COLUMN col SET [NULL | NOT NULL]
>
>Anyone have any ideas? Perhaps we should use some sort of 'MODIFY'-like
>syntax to enable in the future maybe the ability to change column specs in
>more advanced ways (such as column type and size)
>
>If the answer is no, Postgres's parser does not have this syntax enabled,
>then I'm going to have to ask someone to implement it for me, and then I can
>fill in the actual guts of the function - whereever that may be. (I don't
>know parser stuff!)
>
>Chris
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-02-22 03:39:50 Re: elog() proposal
Previous Message Marc Munro 2002-02-22 03:35:42 point in time recovery and moving datafiles online