pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
NULL & NOT NULL
2+ messages / 2 participants
[nested] [flat]

* NULL & NOT NULL
@ 1998-12-08 14:28 Bill Sneed <bsneed@mint.net>
  1998-12-08 14:46 ` Re: [GENERAL] NULL & NOT NULL Herouth Maoz <herouth@oumail.openu.ac.il>
  0 siblings, 1 reply; 2+ messages in thread

From: Bill Sneed @ 1998-12-08 14:28 UTC (permalink / raw)
  To: pgsql-general@hub.org <pgsql-general@hub.org>

I'm  (1) new to postgres & (2) trying to "convert" the sample db found
in "The Practical SQL Handbook" Bowman, et al. to postgres.  When
trying to create the following table I get "parser: parse error at or
near 'null'" 

create table authors (
	au_id		char(11)	not null,
	au_lname	varchar(40)	not null,
	.
	.
	.
	zip		char(5)		null
);

The table creation works fine twith the NOT NULL but won't work with
the NULL.  
NULL is supported isn't it?  I can't see where I'm making a syntax
error.  Got me stumped.  TIA.

........Bill Sneed Prospect, Maine......




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [GENERAL] NULL & NOT NULL
  1998-12-08 14:28 NULL & NOT NULL Bill Sneed <bsneed@mint.net>
@ 1998-12-08 14:46 ` Herouth Maoz <herouth@oumail.openu.ac.il>
  0 siblings, 0 replies; 2+ messages in thread

From: Herouth Maoz @ 1998-12-08 14:46 UTC (permalink / raw)
  To: Bill Sneed <bsneed@mint.net>; +Cc: pgsql-sql

(redirected to the SQL list):

At 16:28 +0200 on 8/12/98, Bill Sneed wrote:


> The table creation works fine twith the NOT NULL but won't work with
> the NULL.
> NULL is supported isn't it?  I can't see where I'm making a syntax
> error.  Got me stumped.  TIA.

The syntax is not supported. Columns allow nulls unless specified as NOT
NULL. So just drop the 'null' to achieve the same effect. In fact, this
NULL is not standard - here is the definition from SQL 1992:

         <column definition> ::=
              <column name> { <data type> | <domain name> }
              [ <default clause> ]
              [ <column constraint definition>... ]
              [ <collate clause> ]

         <column constraint definition> ::=
              [ <constraint name definition> ]
              <column constraint>
                [ <constraint attributes> ]

         <column constraint> ::=
                NOT NULL
              | <unique specification>
              | <references specification>
              | <check constraint definition>

As you can see, you can only write NOT NULL, not simply NULL.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1998-12-08 14:46 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-12-08 14:28 NULL & NOT NULL Bill Sneed <bsneed@mint.net>
1998-12-08 14:46 ` Herouth Maoz <herouth@oumail.openu.ac.il>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox