pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: Wierd postgres Problem
4+ messages / 4 participants
[nested] [flat]
* Wierd postgres Problem
@ 2001-02-13 15:20 Najm Hashmi <najm@mondo-live.com>
2001-02-12 16:05 ` Re: Wierd postgres Problem Michael Fork <mfork@toledolink.com>
2001-02-12 16:15 ` Re: Wierd postgres Problem Peter Eisentraut <peter_e@gmx.net>
2001-02-12 16:24 ` Re: Wierd postgres Problem Tomek Zielonka <tomek@mult.i.pl>
0 siblings, 3 replies; 4+ messages in thread
From: Najm Hashmi @ 2001-02-13 15:20 UTC (permalink / raw)
To: pgsql-sql
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
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Wierd postgres Problem
2001-02-13 15:20 Wierd postgres Problem Najm Hashmi <najm@mondo-live.com>
@ 2001-02-12 16:05 ` Michael Fork <mfork@toledolink.com>
2 siblings, 0 replies; 4+ messages in thread
From: Michael Fork @ 2001-02-12 16:05 UTC (permalink / raw)
To: Najm Hashmi <najm@mondo-live.com>; +Cc: 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
>
>
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Wierd postgres Problem
2001-02-13 15:20 Wierd postgres Problem Najm Hashmi <najm@mondo-live.com>
@ 2001-02-12 16:15 ` Peter Eisentraut <peter_e@gmx.net>
2 siblings, 0 replies; 4+ messages in thread
From: Peter Eisentraut @ 2001-02-12 16:15 UTC (permalink / raw)
To: Najm Hashmi <najm@mondo-live.com>; +Cc: pgsql-sql
Najm Hashmi writes:
> cmdb=# create table media_received (
> cmdb(# comp_id not null,
> cmdb(# dept_id not null,
^
Those two fields should have a data type. Same in your other examples.
> 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"
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Wierd postgres Problem
2001-02-13 15:20 Wierd postgres Problem Najm Hashmi <najm@mondo-live.com>
@ 2001-02-12 16:24 ` Tomek Zielonka <tomek@mult.i.pl>
2 siblings, 0 replies; 4+ messages in thread
From: Tomek Zielonka @ 2001-02-12 16:24 UTC (permalink / raw)
To: pgsql-sql
On Tue, Feb 13, 2001 at 10:20:09AM -0500, Najm Hashmi wrote:
> Hi All,
hi
> 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,
[...]
> is something wrong with my table definition syntex?
Yes, you forgot to specify types for comp_id and dept_id fields.
greetings,
Tom
--
.signature: Too many levels of symbolic links
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2001-02-13 15:20 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-02-13 15:20 Wierd postgres Problem Najm Hashmi <najm@mondo-live.com>
2001-02-12 16:05 ` Michael Fork <mfork@toledolink.com>
2001-02-12 16:15 ` Peter Eisentraut <peter_e@gmx.net>
2001-02-12 16:24 ` Tomek Zielonka <tomek@mult.i.pl>
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