Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-25 Thread Stephan Szabo
On Tue, 26 Mar 2002, Christopher Kings-Lynne wrote: > > Christopher Kings-Lynne <[EMAIL PROTECTED]> writes: > > > I have throught of at least two problems with changing nullability. The > > > first is primary keys. I have to prevent people setting a > > column involved > > > in a PK to null, r

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-25 Thread Tom Lane
"Christopher Kings-Lynne" <[EMAIL PROTECTED]> writes: > What about temporary tables - is there any reason they shouldn't be able to > modify a temporary table? I don't see one. > What about indices? Will twiddling the nullability break indices on a table > in any way? No, not as long as you ar

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-25 Thread Christopher Kings-Lynne
> Christopher Kings-Lynne <[EMAIL PROTECTED]> writes: > > I have throught of at least two problems with changing nullability. The > > first is primary keys. I have to prevent people setting a > column involved > > in a PK to null, right? > > Probably so. What about temporary tables - is there a

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-24 Thread Christopher Kings-Lynne
> ALTER TABLE blah ALTER [COLUMN] col SET NOT NULL; > > and > > ALTER TABLE blah ALTER [COLUMN] col DROP NOT NULL; > > This is synchronous with the SET/DROP default stuff and is > extensible in the > future to fit in with column type changing. > > Of course, it can always be changed in the parser

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-24 Thread Christopher Kings-Lynne
> OK, how about: > > SET CONSTRAINT NOT NULL > > or > > DROP CONSTRAINT NOT NULL > > or simply: > > SET/DROP NOT NULL > > I think the problem with trying to get it look like CREATE TABLE is that > the plain NULL parameter to CREATE TABLE is meaningless and probably > should never

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-23 Thread Tom Lane
Christopher Kings-Lynne <[EMAIL PROTECTED]> writes: > I have throught of at least two problems with changing nullability. The > first is primary keys. I have to prevent people setting a column involved > in a PK to null, right? Probably so. > The second is DOMAINs - what if they change a NOT N

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-23 Thread Christopher Kings-Lynne
> You could possibly make it work if you were willing to include the word > TYPE when trying to respecify column type: > > ALTER TABLE blah ALTER [COLUMN] col [TYPE int4] [NOT NULL] [DEFAULT 32]; > > Also I agree with Fernando that trying to make the word COLUMN optional > is likely to lead to con

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-22 Thread Bruce Momjian
Thomas Lockhart wrote: > ... > > "CREATE TABLE test (x int NULL)" doesn't look great either. :-) What > > is that NULL doing there? > > Well, because NOT NULL *was* in the standard, and because one should be > able to explicitly negate *that*. The alternative was > > CREATE TABLE test (x int

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-22 Thread Thomas Lockhart
... > "CREATE TABLE test (x int NULL)" doesn't look great either. :-) What > is that NULL doing there? Well, because NOT NULL *was* in the standard, and because one should be able to explicitly negate *that*. The alternative was CREATE TABLE test (x int NOT NOT NULL) :O

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-22 Thread Bruce Momjian
Tom Lane wrote: > "Ross J. Reedstrom" <[EMAIL PROTECTED]> writes: > > BTW, is NULLABLE so ugly that no one wanted to comment on it? > > I kinda liked it, actually, if we were going to use the SET syntax. > But people seem to be focused in on this "let's make it look like > CREATE" notion. I'm wi

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-22 Thread Neil Conway
On Fri, 2002-03-22 at 14:00, Ross J. Reedstrom wrote: > BTW, is NULLABLE so ugly that no one wanted to comment on it? It _is_ > an sql92 reserved keyword, and it's actual english grammar. FWIW, I liked it the best of all the solutions that have been proposed so far. Cheers, Neil -- Neil Conwa

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-22 Thread Tom Lane
"Ross J. Reedstrom" <[EMAIL PROTECTED]> writes: > BTW, is NULLABLE so ugly that no one wanted to comment on it? I kinda liked it, actually, if we were going to use the SET syntax. But people seem to be focused in on this "let's make it look like CREATE" notion. I'm willing to wait and see how fa

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-22 Thread Ross J. Reedstrom
On Fri, Mar 22, 2002 at 01:12:09PM -0500, Tom Lane wrote: > > Also I agree with Fernando that trying to make the word COLUMN optional > is likely to lead to conflicts. According to the docs, COLUMN is _already_ optional at that point. Are the changes past that point going to cause different prob

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-22 Thread Tom Lane
"Zeugswetter Andreas SB SD" <[EMAIL PROTECTED]> writes: > ALTER TABLE blah ALTER [COLUMN] col [int4] [NOT NULL] [DEFAULT 32]; > ALTER TABLE blah ALTER [COLUMN] col [int8] [NULL] [DEFAULT 32]; This cannot work unless you are prepared to turn a lot more keywords into reserved words. In the CREATE

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-22 Thread Fernando Nasser
Zeugswetter Andreas SB SD wrote: > > Imho it would be nice if the command would look exactly like a create > table. It is simply convenient to use cut and paste :-) And I haven't > seen a keyword yet, that would make it more descriptive, certainly not SET. > > ALTER TABLE blah ALTER [COLUMN] col

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-22 Thread Peter Eisentraut
Christopher Kings-Lynne writes: > So then how is it any more wrong than SET NOT NULL? You're right. > It should almost be ADD NOT NULL ... I like that. It also makes sense because the standard syntax is to ADD/DROP CHECK constraints, to which NOT NULL constraints are equivalent. -- Peter Ei

Re: [HACKERS] SET NULL/SET NOT NULL

2002-03-22 Thread Dwayne Miller
seems like other systems keep very similar syntax to the CREATE TABLE command. i.e. ALTER TABLE blah ALTER COLUMN col datatype (precision.scale) NULL ALTER TABLE blah ALTER COLUMN col datatype (precision.scale) NOT NULL Dwayne ---(end of broadcast)--

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-22 Thread Zeugswetter Andreas SB SD
> > Do we want the above syntax, or this syntax: > > > > ALTER TABLE blah ALTER COLUMN col SET NOT NULL; > > ALTER TABLE blah ALTER COLUMN col SET NULL; > > My only objection to the second command is that it's plain wrong. You > don't set anything to NULL, so don't make the command look like it

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-22 Thread D'Arcy J.M. Cain
On March 22, 2002 01:31 am, Peter Eisentraut wrote: > Christopher Kings-Lynne writes: > > Do we want the above syntax, or this syntax: > > > > ALTER TABLE blah ALTER COLUMN col SET NOT NULL; > > ALTER TABLE blah ALTER COLUMN col SET NULL; > > My only objection to the second command is that it's pl

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-21 Thread Ross J. Reedstrom
On Fri, Mar 22, 2002 at 02:34:57PM +0800, Christopher Kings-Lynne wrote: > > > Do we want the above syntax, or this syntax: > > > > > > ALTER TABLE blah ALTER COLUMN col SET NOT NULL; > > > ALTER TABLE blah ALTER COLUMN col SET NULL; > > > > My only objection to the second command is that it's pl

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-21 Thread Christopher Kings-Lynne
> > Do we want the above syntax, or this syntax: > > > > ALTER TABLE blah ALTER COLUMN col SET NOT NULL; > > ALTER TABLE blah ALTER COLUMN col SET NULL; > > My only objection to the second command is that it's plain wrong. You > don't set anything to NULL, so don't make the command look like it.

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-21 Thread Bruce Momjian
Tom Lane wrote: > "Christopher Kings-Lynne" <[EMAIL PROTECTED]> writes: > > Say in the future we want to support changing column type as well. How > > would we work that in? > > > ALTER TABLE blah ALTER COLUMN col SET int4; ?? > > Seems one keyword shy of a load; I'd prefer > > ALTER TABL

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-21 Thread Peter Eisentraut
Christopher Kings-Lynne writes: > Do we want the above syntax, or this syntax: > > ALTER TABLE blah ALTER COLUMN col SET NOT NULL; > ALTER TABLE blah ALTER COLUMN col SET NULL; My only objection to the second command is that it's plain wrong. You don't set anything to NULL, so don't make the co

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-21 Thread Christopher Kings-Lynne
> Seems one keyword shy of a load; I'd prefer > > ALTER TABLE blah ALTER COLUMN col SET TYPE int4; > > Otherwise, every keyword that might appear after SET will have to be > fully reserved (else it couldn't be distinguished from a type name). I like that... So would you then envisage something l

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-21 Thread Tom Lane
"Christopher Kings-Lynne" <[EMAIL PROTECTED]> writes: > Say in the future we want to support changing column type as well. How > would we work that in? > ALTER TABLE blah ALTER COLUMN col SET int4; ?? Seems one keyword shy of a load; I'd prefer ALTER TABLE blah ALTER COLUMN col SET TYPE i

Re: [HACKERS] SET NULL / SET NOT NULL

2002-03-21 Thread Christopher Kings-Lynne
Hi, I'm halfway thru implementing setting a column's nullness (I've done changing to null, but not changing to not null) Peter E. said: > Using the standard precedent above, how about > > ALTER TABLE blah ALTER COLUMN col SET NOT NULL; > ALTER TABLE blah ALTER COLUMN col DROP NOT NULL; Do we w