Thread: Sequence query
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
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 toask 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/ > Magnetism, electricity and motion are like a three-for-two special offer: > if you have two of them, the third one comes free.
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.
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