Re: [GENERAL] Syntax error needs fresh eyeballs

Поиск
Список
Период
Сортировка
От Mike Sofen
Тема Re: [GENERAL] Syntax error needs fresh eyeballs
Дата
Msg-id 018b01d25fd1$732fc600$598f5200$@runbox.com
обсуждение исходный текст
Ответ на [GENERAL] Syntax error needs fresh eyeballs  (Rich Shepard <rshepard@appl-ecosys.com>)
Список pgsql-general

From: Rich Shepard
   My schema includes three tables and psql throws an error I'm not seeing when I try to read the schema into the database. I'd appreciate fresh eyes looking at the table and learning what error I'm not seeing.

 

   The tables:

CREATE TABLE Weather (

   site_id INTEGER PRIMARY KEY,

   site_name TEXT,

   site_location TEXT

);

CREATE TABLE Weather_Params (

   site_id INTEGER

              REFERENCES Weather(site_id),

   param TEXT,

   param_unit TEXT,

   freq INTEGER,

   freq_unit TEXT,

   equip TEXT,

   PRIMARY KEY (site_id, param)

);

CREATE TABLE Weather_Data (

   site_id INTEGER

              REFERENCES Weather(site_id),

   monit_date DATE,

   monit_time TIME,

   read_by TEXT,  -- name of employee collecting data

   param TEXT

              REFERENCES Weather_Params(param),

   param_value REAL,

   PRIMARY KEY (site_id, monit_date, monit_time, param) );

 

   The error:  ERROR:  there is no unique constraint matching given keys for referenced table "weather_params".

-----------------------

Just a guess...You've camel-cased the table names but aren't using double quotes.  Try either lower-casing all table names and references to them, or double-quoting all identifiers. 

 

Mike

 

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] Syntax error needs fresh eyeballs
Следующее
От: Rich Shepard
Дата:
Сообщение: Re: [GENERAL] Syntax error needs fresh eyeballs