Problem creating database
Hello.
I have a problem with a script creating database. I don't know where can be
error. Can you help me, please.
* Error:
Relation 'empleado' does not exist
* script:
-----------------8<----------------------------------------------
create database multi;
\connect multi
------------------------------
-- Tabla gen�rica de la que heredan todas las tablas persona.
create table datos_persona (
dni text,
nombre text,
calle int4,
direcci�n text,
cp text,
localidad int2,
provincia int2,
tel�fono text,
tel�fono2 text,
e_mail text,
fax text,
detalle text,
activo bool default 't'
);
create table pepis (
cod serial primary key,
ss text
) inherits (datos_persona);
-----------------------------
create table cliente (
cod serial primary key,
empresa text
) inherits (datos_persona);
create index cli_nombre_ndx on cliente (nombre);
create index cli_direccion_ndx on cliente (calle,direcci�n);
create index cli_telefono_ndx on cliente (tel�fono);
create index cli_telefono2_ndx on cliente (tel�fono2);
create index cli_cp_ndx on cliente (cp);
create index cli_localidad_ndx on cliente (localidad);
create index cli_provincia_ndx on cliente (provincia);
-----------------------------------
-- Engloba clientes y administradores. Puede haber varios por aviso.
create table cliente_aviso (
aviso int4,
cliente int4 references pepis,
primary key (aviso, cliente)
);
create index cliente_aviso_cliente_ndx on cliente_aviso (cliente);
------------------------------
create table empleado (
cod serial primary key,
alta timestamp,
baja timestamp,
s_social text,
nombre_usuario text, -- Solo tiene valor para los administrativos.
�ltimo_orden int4 -- Solo tiene valor para los t�cnicos.
) inherits (datos_persona);
create index emp_nombre_ndx on empleado (nombre);
create index emp_direccion_ndx on empleado (calle,direcci�n);
create index emp_telefono_ndx on empleado (tel�fono);
create index emp_telefono2_ndx on empleado (tel�fono2);
create index emp_cp_ndx on empleado (cp);
create index emp_localidad_ndx on empleado (localidad);
create index emp_provincia_ndx on empleado (provincia);
---------------------------------
create table administrativo_aviso (
aviso int4,
empleado int4 references empleado,
fecha timestamp,
comentario text,
primary key (aviso, empleado, fecha)
);
create index adm_aviso_empleado_ndx on administrativo_aviso (empleado);
create index adm_aviso_fecha_ndx on administrativo_aviso (fecha);
--------------------8<----------------------------------------------------------
I use PG 7.0.2.
Why I obtain error with 'empleado' but not with 'pepis'? Can be a bug?
Thanks for your help.
David
DaVinci <davinci@escomposlinux.org> writes:
I have a problem with a script creating database. I don't know where can be
error. Can you help me, please.
Relation 'empleado' does not exist
Hm. I can't duplicate this problem --- running the given script under
7.0.2 produces no error here. Maybe the problem is platform or locale
specific? Can anyone else duplicate this error message?
regards, tom lane
On Tue, Nov 21, 2000 at 01:49:16AM -0500, Tom Lane wrote:
DaVinci <davinci@escomposlinux.org> writes:
I have a problem with a script creating database. I don't know where can be
error. Can you help me, please.Relation 'empleado' does not exist
Hm. I can't duplicate this problem --- running the given script under
7.0.2 produces no error here. Maybe the problem is platform or locale
specific? Can anyone else duplicate this error message?
Problem get out when I detail field name in references lines:
create table administrativo_aviso (
cod serial primary key,
aviso int4 not null references aviso(n�mero), <--��!!
empleado int4 not null references empleado(cod), <--��!!
fecha timestamp,
comentario text
);
If I put only table names, then I get error.
My locale is 'spanish', and platform i386 with Debian GNU/Linux, Postgresql
7.0.2.
Greets.
David