phpN00b
phpN00b

Reputation: 807

PostgreSQL create table syntax

I'm more a mysql person, but I have to do a db in pg and the following CREATE TABLE keeps generating syntax errors... I just get an error: ERROR: syntax error at or near "(" and error: ERROR: syntax error at or near ")" Googling around didn't give me much help... I'm sure that I'm doing something mysql-esque and that's causing problems... (Note: I did already create the mfseq successfully...)

CREATE TABLE master_file (
    mfid INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('mfseq'),
    prefix VARCHAR(4),
    fname VARCHAR(30) NOT NULL,
    lname VARCHAR(80) NOT NULL,
    MI varchar(1) NULL,
    address1 VARCHAR(200) NOT NULL,
    address2 VARCHAR(200),
    city VARCHAR(28),
    state VARCHAR(2),
    zip INT(5),
    zip_plus4 INT(4),
    mrn VARCHAR(30),
    aID INT,
    iID INT,
    gID VARCHAR(1),
    pphone VARCHAR(10);
);

Upvotes: 1

Views: 2770

Answers (2)

Jimmy Stenke
Jimmy Stenke

Reputation: 11220

It should not be a semi-colon here: pphone VARCHAR(10);

Upvotes: 1

silent
silent

Reputation: 3923

Maybe int -> integer and without size (or numeric) and delete the delimiter at pphone field.

Upvotes: 2

Related Questions