Thread: Serials in where clause

Serials in where clause

From
j0rd1 adame
Date:
Im having trouble whith a Serial Primary key that i cannot use in a where
clause

here is what i did

ixmati=# create table jordi(
ixmati(# "jordi_idPK" serial NOT NULL,
ixmati(# jordi_nombre varchar);
NOTICE:  CREATE TABLE creará una secuencia implícita "jordi_jordi_idPK_seq"
para la columna "serial" "jordi.jordi_idPK"
CREATE TABLE
ixmati=# alter table only jordi
ixmati-# add constraint "jordi_idPK" primary key ( "jordi_idPK");
NOTICE:  ALTER TABLE / ADD PRIMARY KEY creará el índice implícito "jordi_idPK"
para la tabla "jordi"


Here is the error
ixmati=# select * from jordi where jordi_idPK = 1;
ERROR:  column "jordi_idpk" doesn't exists


Any ideas??
thanx
j0rd1


Re: Serials in where clause

From
Josué Maldonado
Date:
Try this:

select * from jordi where "jordi_idPK" = 1


El 05/07/2004 12:31 PM, j0rd1 adame en su mensaje escribio:
> Im having trouble whith a Serial Primary key that i cannot use in a where
> clause
>
> here is what i did
>
> ixmati=# create table jordi(
> ixmati(# "jordi_idPK" serial NOT NULL,
> ixmati(# jordi_nombre varchar);
> NOTICE:  CREATE TABLE creará una secuencia implícita "jordi_jordi_idPK_seq"
> para la columna "serial" "jordi.jordi_idPK"
> CREATE TABLE
> ixmati=# alter table only jordi
> ixmati-# add constraint "jordi_idPK" primary key ( "jordi_idPK");
> NOTICE:  ALTER TABLE / ADD PRIMARY KEY creará el índice implícito "jordi_idPK"
> para la tabla "jordi"
>
>
> Here is the error
> ixmati=# select * from jordi where jordi_idPK = 1;



--
Sinceramente,
Josué Maldonado.

"Theta pone orden en el caos conquistando todo lo que en mest pueda ser
prosupervivencia y destruyendo todo lo que en mest pueda ser
contrasupervivencia, al menos por medio de organismos vivos."

Re: Serials in where clause

From
Stephan Szabo
Date:
On Mon, 5 Jul 2004, j0rd1 adame wrote:

> Im having trouble whith a Serial Primary key that i cannot use in a where
> clause
>
> here is what i did
>
> ixmati=# create table jordi(
> ixmati(# "jordi_idPK" serial NOT NULL,
> ixmati(# jordi_nombre varchar);
> NOTICE:  CREATE TABLE creará una secuencia implícita "jordi_jordi_idPK_seq"
> para la columna "serial" "jordi.jordi_idPK"
> CREATE TABLE
> ixmati=# alter table only jordi
> ixmati-# add constraint "jordi_idPK" primary key ( "jordi_idPK");
> NOTICE:  ALTER TABLE / ADD PRIMARY KEY creará el índice implícito "jordi_idPK"
> para la tabla "jordi"
>
>
> Here is the error
> ixmati=# select * from jordi where jordi_idPK = 1;
> ERROR:  column "jordi_idpk" doesn't exists

You created the column with double quotes, so when you want to refer to
it, you should use double quotes as well ("jordi_idPK" = 1)

Re: [ok] Re: Serials in where clause

From
j0rd1 adame
Date:
El Lun 05 Jul 2004 14:03, Stephan Szabo escribió:
> You created the column with double quotes, so when you want to refer to
> it, you should use double quotes as well ("jordi_idPK" = 1)
This is an  error I had for creating tables using pgadmin3, but now i know
thanx

j0rd1