Thread: problems with CREATE TABLE

problems with CREATE TABLE

From
"Martin A. Marques"
Date:
I'm on Potsgres 7.0.2 on Solaris, and I get a parse error when I try to
create this table:

CREATE TABLE ubicacion (
       id        SERIAL,
       id_palabra    INT,
       tabla        INT NOT NULL,
       id_row        INT NOT NULL,
       CONSTRAINT "fk_ubic_id_palabra" FOREIGN KEY id_palabra
REFERENCES palabras ("pid"),
       CONSTRAINT "fk_tabla_s" FOREIGN KEY tabla REFERENCES tablas
("id_tabla")
);

OK,  the table palabras and the table tablas exist, as they also have those
columnas to reference to. The error I get is:

ERROR:  parser: parse error at or near "id_palabra"

If you need the CREATE TABLE statements of the other tables I can send them.

Saludos... :-)

--
"And I'm happy, because you make me feel good, about me." - Melvin Udall
-----------------------------------------------------------------
Martín Marqués            email:     martin@math.unl.edu.ar
Santa Fe - Argentina        http://math.unl.edu.ar/~martin/
Administrador de sistemas en math.unl.edu.ar
-----------------------------------------------------------------

Re: problems with CREATE TABLE

From
Peter Eisentraut
Date:
Martin A. Marques writes:

> CREATE TABLE ubicacion (
>        id        SERIAL,
>        id_palabra    INT,
>        tabla        INT NOT NULL,
>        id_row        INT NOT NULL,
>        CONSTRAINT "fk_ubic_id_palabra" FOREIGN KEY id_palabra
> REFERENCES palabras ("pid"),

... FOREIGN KEY (id_palabra) REFERENCES ...

>        CONSTRAINT "fk_tabla_s" FOREIGN KEY tabla REFERENCES tablas
> ("id_tabla")
> );

> ERROR:  parser: parse error at or near "id_palabra"

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/