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

* Default sequence values
@ 2000-02-27 07:45 Seth Banks <seth@subimage.com>
  2000-02-27 07:48 ` Re: [SQL] Default sequence values Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Seth Banks @ 2000-02-27 07:45 UTC (permalink / raw)
  To: pgsql-sql

I'm getting errors in pgsql when I try to run this create table statement
past...Could someone help me out here? I think it's the default value of
company_id that's erroring out. Any help is appreciated.

CREATE SEQUENCE company_id_seq;
CREATE TABLE company (
  company_id     int4 PRIMARY KEY DEFAULT nextval(company_id_seq),
  parent_id      int4 NULL,
  name           text NOT NULL,
  address_1      text NULL,
  address_2      text NULL,
  fax            text NULL,
  city           text NULL,
  state_province text NULL,
  zip            text NULL,
  country        text NULL,
  description    text NULL,
  stock_symbol   text NULL
);
CREATE INDEX name_idx on company (name);




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

* Re: [SQL] Default sequence values
  2000-02-27 07:45 Default sequence values Seth Banks <seth@subimage.com>
@ 2000-02-27 07:48 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2000-02-27 07:48 UTC (permalink / raw)
  To: Seth Banks <seth@subimage.com>; +Cc: pgsql-sql

"Seth Banks" <seth@subimage.com> writes:
>   company_id     int4 PRIMARY KEY DEFAULT nextval(company_id_seq),

Try

  company_id     int4 PRIMARY KEY DEFAULT nextval('company_id_seq'),

Actually, this would work just as well:

  company_id     SERIAL,

and it'd even make the sequence object for you.

			regards, tom lane



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


end of thread, other threads:[~2000-02-27 07:48 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-02-27 07:45 Default sequence values Seth Banks <seth@subimage.com>
2000-02-27 07:48 ` Tom Lane <tgl@sss.pgh.pa.us>

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