Skip site navigation (1) Skip section navigation (2)

alter table

From: Pavel SRB <srb(at)heckler-koch(dot)cz>
To: pgsql-novice(at)postgresql(dot)org
Subject: alter table
Date: 2008-04-07 20:53:20
Message-ID: 47FA89C0.5080808@heckler-koch.cz (view raw or flat)
Thread:
Lists: pgsql-novice
hi all

please i have one question. I made table called tab_article with

CREATE TABLE "tab_article" (
    "id" serial NOT NULL PRIMARY KEY,
    "flag" boolean NOT NULL,
    "title" text NOT NULL,
    "journal" integer NOT NULL,
    "doi" varchar(255) NOT NULL,
    "year" integer NOT NULL,
    "volume" integer NOT NULL,
    "issue" integer NOT NULL,
    "pages_start" integer NOT NULL,
    "pages_end" integer NOT NULL,
    "printed" boolean NOT NULL,
    "public" boolean NOT NULL,
    "entry" boolean NOT NULL,
    "filename" integer NOT NULL,
    "language" integer NOT NULL,
    "link" integer NOT NULL,
    "info" varchar(255) NOT NULL
);

and later another table called tab_journal

CREATE TABLE "tab_journal" (
    "id" serial NOT NULL PRIMARY KEY,
    "flag" boolean NOT NULL,
    "name" text NOT NULL,
    "publisher" integer NOT NULL,
    "issn_print" integer NOT NULL,
    "issn_online" integer NOT NULL,
    "link" integer NOT NULL,
    "date_range" varchar(255) NOT NULL
);

and i needed to change column journal in tab_article to be set like
"journal_id" integer NOT NULL REFERENCES "article_journal" ("id")

and i am not able to find the right alter table command.
thank you very much

pavel




Responses

pgsql-novice by date

Next:From: Sean DavisDate: 2008-04-07 21:08:19
Subject: Re: alter table
Previous:From: richard terryDate: 2008-04-07 03:45:13
Subject: Re: best practices for dumping databases

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group