Re: error en varios editores sql

From: "Gilberto Castillo" <gilberto(dot)castillo(at)etecsa(dot)cu>
To: "Freddy Martinez Garcia" <freddy311082(at)gmail(dot)com>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: error en varios editores sql
Date: 2015-02-12 18:57:08
Message-ID: 32776.192.168.207.54.1423767428.squirrel@192.168.91.6
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
> )

Se me ocurre en la definición de REFERENCES pongas:
public.fruits_in_stock(NAME)

Saludos,
Gilberto Castillo
La Habana, Cuba

Attachment Content-Type Size
unknown_filename text/plain 179 bytes
unknown_filename text/plain 157 bytes

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Roberto Estupiñán Pérez 2015-02-14 13:35:42 restaurar DB a mano
Previous Message Freddy Martinez Garcia 2015-02-12 18:50:39 error en varios editores sql