ERROR: relation "employees" does not exist

Started by Csanyi Palabout 13 years ago3 messagesgeneral
Jump to latest
#1Csanyi Pal
csanyipal@gmail.com

Hi,

I just installed Postgresql 9.2 on my Debian Wheezy system.

I want to study and learn about new data type, the range type.

I'm following the tutorial:
https://wiki.postgresql.org/images/7/73/Range-types-pgopen-2012.pdf

but when I run the command:
CREATE TABLE employee_schedule (
id serial,
employee_id integer REFERENCES employees(id),
start_time timestamptz,
end_time timestamptz
);

I get an error message:

NOTICE: CREATE TABLE will create implicit sequence
"employee_schedule_id_seq" for serial column "employee_schedule.id"
ERROR: relation "employees" does not exist

So how can I solve this problem?

--
Regards from Pal

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Andreas Kretschmer
akretschmer@spamfence.net
In reply to: Csanyi Pal (#1)
Re: ERROR: relation "employees" does not exist

Csanyi Pal <csanyipal@gmail.com> wrote:

Hi,

I just installed Postgresql 9.2 on my Debian Wheezy system.

I want to study and learn about new data type, the range type.

I'm following the tutorial:
https://wiki.postgresql.org/images/7/73/Range-types-pgopen-2012.pdf

but when I run the command:
CREATE TABLE employee_schedule (
id serial,
employee_id integer REFERENCES employees(id),
start_time timestamptz,
end_time timestamptz
);

I get an error message:

NOTICE: CREATE TABLE will create implicit sequence
"employee_schedule_id_seq" for serial column "employee_schedule.id"
ERROR: relation "employees" does not exist

So how can I solve this problem?

Create a simple table first:

create table employees (id int primary key, ...)

or omit the REFERENCES employees(id).

Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082�, E 13.56889�

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Alban Hertroys
haramrae@gmail.com
In reply to: Csanyi Pal (#1)
Re: ERROR: relation "employees" does not exist

On 11 March 2013 07:39, Csanyi Pal <csanyipal@gmail.com> wrote:

but when I run the command:
CREATE TABLE employee_schedule (
id serial,
employee_id integer REFERENCES employees(id),
start_time timestamptz,
end_time timestamptz
);

I get an error message:

NOTICE: CREATE TABLE will create implicit sequence
"employee_schedule_id_seq" for serial column "employee_schedule.id"
ERROR: relation "employees" does not exist

So how can I solve this problem?

You have a foreign key reference (employee_id) to a table (employees) that
can't be found in your search_path.

--
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.