error en varios editores sql

From: Freddy Martinez Garcia <freddy311082(at)gmail(dot)com>
To: pgsql-es-ayuda(at)postgresql(dot)org
Subject: error en varios editores sql
Date: 2015-02-12 18:50:39
Message-ID: E94D8358-481F-4153-95F3-5AFF03B57912@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Hola amigos...

tengo este codigo sql
CREATE TABLE public.fruits_in_stock(
NAME INTEGER PRIMARY KEY,
in_stock INTEGER NOT NULL,
reserved INTEGER NOT NULL DEFAULT 0,
CHECK(in_stock BETWEEN 0 AND 1000),
CHECK(reserved <= in_stock)
);

CREATE TABLE public.fruits_offer(
offer_id SERIAL PRIMARY KEY,
recipient_name TEXT,
offer_date TIMESTAMP DEFAULT current_timestamp,
fruit_name INTEGER REFERENCES public.fruits_in_stock(NAME) ON DELETE CASCADE
);
esto cuando lo ejecuto en el PyCharm Professional Edition me da el siguiente error:
sql> CREATE TABLE public.fruits_offer(
offer_id SERIAL PRIMARY KEY,
recipient_name TEXT,
offer_date TIMESTAMP DEFAULT current_timestamp,
fruit_name INTEGER REFERENCES fruits_in_stock(NAME) ON DELETE CASCADE
)
[2015-02-12 15:47:07] [42P01] ERROR: relation "fruits_in_stock" does not exist

si lo ejecuto en el Navicat me da el mismo error,

pero si lo ejecuto en el PgAdmin3 se ejecuta perfectamente bien y se crean las tablas....

¿hay algún problema ahí que el PgAdmin3 me resuelve por defecto??

saludos

=============================================
"El tamaño de tus logros depende del tamaño de tus metas."
C++ and Qt Senior Developer
Lic. Computer Science
Buenos Aires, Argentina

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Gilberto Castillo 2015-02-12 18:57:08 Re: error en varios editores sql
Previous Message jemc 2015-02-11 23:38:34 Error al enlazar con codeblocks