From: | Michael Fork <mfork(at)toledolink(dot)com> |
---|---|
To: | Najm Hashmi <najm(at)mondo-live(dot)com> |
Cc: | pgsql <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Wierd postgres Problem |
Date: | 2001-02-12 16:05:35 |
Message-ID: | Pine.BSI.4.21.0102121100290.21572-100000@glass.toledolink.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Your missing your fields types, i.e.:
CREATE TABLE media_received (
comp_id SERIAL NOT NULL,
dept_id INT4 NOT NULL,
date_rec TIMESTAMP DEFAULT 'now',
that should fix your problem...
Michael Fork - CCNA - MCP - A+
Network Support - Toledo Internet Access - Toledo Ohio
On Tue, 13 Feb 2001, Najm Hashmi wrote:
> Hi All,
> I am trying to define a new set of tables an I am getting this strange
> syntex problem on date, or timestamp data types. I am also getting error on
> not null constranit as well... Postgres is behaving strangely.... first
> definations with not null
>
> cmdb=# create table media_received (
> cmdb(# comp_id not null,
> cmdb(# dept_id not null,
> cmdb(# date_rec timestamp default 'now',
> cmdb(# units int4 default 0,
> cmdb(# media_type varchar(64),
> cmdb(# enqued int4 check (enqued=<units),
> cmdb(# encoded int4 check(encoded=<enqued),
> cmdb(# insys int4 check(insys=<encoded),
> cmdb(# constraint media_rec_pk primary key(comp_id,dept_id,date_rec),
> cmdb(# constraint media_dept_fk foreign key(dept_id) references department,
> cmdb(# constraint media_comp_fk foreign key(comp_id) references company
> cmdb(# );
> ERROR: parser: parse error at or near "not"
>
> Second definition without not null and data type timestamp,
> cmdb=# create table media_received (
> cmdb(# comp_id,
> cmdb(# dept_id,
> cmdb(# date_rec timestamp,
> cmdb(# units int4 default 0,
> cmdb(# media_type varchar(64),
> cmdb(# enqued int4 check (enqued=<units),
> cmdb(# encoded int4 check(encoded=<enqued),
> cmdb(# insys int4 check(insys=<encoded),
> cmdb(# constraint media_rec_pk primary key(comp_id,dept_id,date_rec),
> cmdb(# constraint media_dept_fk foreign key(dept_id) references department,
> cmdb(# constraint media_comp_fk foreign key(comp_id) references company
> cmdb(# );
> ERROR: parser: parse error at or near "timestamp"
> 3rd def with date as data type:
> cmdb=# create table media_received (
> cmdb(# comp_id,
> cmdb(# dept_id,
> cmdb(# date_rec date,
> cmdb(# units int4 default 0,
> cmdb(# media_type varchar(64),
> cmdb(# enqued int4 check (enqued=<units),
> cmdb(# encoded int4 check(encoded=<enqued),
> cmdb(# insys int4 check(insys=<encoded),
> cmdb(# constraint media_rec_pk primary key(comp_id,dept_id,date_rec),
> cmdb(# constraint media_dept_fk foreign key(dept_id) references department,
> cmdb(# constraint media_comp_fk foreign key(comp_id) references company
> cmdb(# );
> ERROR: parser: parse error at or near "date"
>
> is something wrong with my table definition syntex?
> All kind of help is appreciated.
> Regards, Najm
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2001-02-12 16:05:54 | Re: plpgsql grief |
Previous Message | Tom Lane | 2001-02-12 16:01:41 | Re: view does not show all records it should |