Sequence query

Started by Tamara D. Blumover 24 years ago4 messagesgeneral
Jump to latest
#1Tamara D. Blum
tblum@jus.gov.ar

Hi !

I need to ask for the following secuence number for a field.
I am connecting PostgreSQL with an ODBC Driver and with ADO.
If i ask for the value of the field after updating the recordset, i get it is null (and it can't be), so i read how to ask for information about sequences and i founded that "SELECT * FROM objetos_ID_seq" would be ok, but i got an error: "The Relation 'objetos_Id_seq' does not exist".

What's wrong ? Is there any problem with my sequence ?

Thanks

Tamara D. Blum
Analista de Sistemas
Tel.: 4831-9061 al 66 int. 110
Sistema Argentino de Informatica Juridica
Ministerio de Justicia y Derechos Humanos

#2Martijn van Oosterhout
kleptog@svana.org
In reply to: Tamara D. Blum (#1)
Re: Sequence query

On Fri, Sep 14, 2001 at 01:19:42PM -0300, Tamara D. Blum wrote:

I need to ask for the following secuence number for a field.
I am connecting PostgreSQL with an ODBC Driver and with ADO.
If i ask for the value of the field after updating the recordset, i get it is null (and it can't be), so i read how to ask for information about sequences and i founded that "SELECT * FROM objetos_ID_seq" would be ok, but i got an error: "The Relation 'objetos_Id_seq' does not exist".

What's wrong ? Is there any problem with my sequence ?

select currval('my_sequence');

--
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/

Show quoted text

Magnetism, electricity and motion are like a three-for-two special offer:
if you have two of them, the third one comes free.

#3Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: Tamara D. Blum (#1)
Re: Sequence query

On Fri, 14 Sep 2001, Tamara D. Blum wrote:

Hi !

I need to ask for the following secuence number for a field. I am
connecting PostgreSQL with an ODBC Driver and with ADO. If i ask for
the value of the field after updating the recordset, i get it is null
(and it can't be), so i read how to ask for information about
sequences and i founded that "SELECT * FROM objetos_ID_seq" would be
ok, but i got an error: "The Relation 'objetos_Id_seq' does not
exist".

What's wrong ? Is there any problem with my sequence ?

Have you tried double quoting the sequence name? My first guess is
that it's a mixed case problem.

#4Justin Clift
justin@postgresql.org
In reply to: Tamara D. Blum (#1)
Re: Sequence query

Hi Tamara,

Have you fixed this yet?

It looks like you've quoted the table name wrongly.

i.e. You should write :

SELECT * FROM "objetos_ID_seq";

instead of :

SELECT * FROM "objetos_Id_seq";

When something it quoted, it is case sensitive. When it's not quoted,
it's made into lowercase before being used.

i.e. :

SELECT * FROM OBJETOS_ID_SEQ;

is the same as :

SELECT * FROM objetos_id_seq;

But,

SELECT * FROM "OBJETOS_ID_SEQ";

is NOT the same as :

SELECT * FROM "objetos_id_seq";

Hope that helps.

Regards and best wishes,

Justin Clift

"Tamara D. Blum" wrote:

Hi !

I need to ask for the following secuence number for a field.
I am connecting PostgreSQL with an ODBC Driver and with ADO.
If i ask for the value of the field after updating the recordset, i
get it is null (and it can't be), so i read how to ask for information
about sequences and i founded that "SELECT * FROM objetos_ID_seq"
would be ok, but i got an error: "The Relation 'objetos_Id_seq' does
not exist".

What's wrong ? Is there any problem with my sequence ?

Thanks

Tamara D. Blum
Analista de Sistemas
Tel.: 4831-9061 al 66 int. 110
Sistema Argentino de Inform�tica Jur�dica
Ministerio de Justicia y Derechos Humanos

--
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
- Indira Gandhi