Thread: Relation does not exist

Relation does not exist

From
"Brian Schroeder"
Date:
Hi everyone.

I am new to this list, and a real novice with databases.

A while back I created a database using postgres 7.03 in Mandrake 7.2.
It is a catalog for all my books.

Although not really knowing what I was doing, I have recently upgraded
it to 7.2 along with Mandrake 8.2.  I did a dump_all from 7.03, and
then read it all in to psql in 7.2.

When I try to view the database, everything is there and looks OK.  But
if I try to insert a new entry I get the following error:

ERROR: Relation "books_bookid_seq" does not exist.

Using phpPgadmin shows:

Field    Type   Length  Not Null   Default
BookId   Int4   4       Yes        nextval('Books_BookID_seq'::text)

What do I need to do?

Brian

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx


Re: Relation does not exist

From
April L
Date:
in your queries you have to refer to it with propercase and enclose in "
quotes

so books_bookid_seq will cause the error

"Books_BookID_seq" will be ok...

I'm also a novice... I don't know what you are doing but here is an example
of properly referring to a column called Cars in a table called Customers
like this

"Customers"."Cars"

if you run a windows machine connecting to your pg machine, nice easy
interface is PGExplorer or PGAdmin. They show you this kind of thing to
some extent and PGExplorer helps write the syntax to some extent.

- April

At 11:53 AM 5/8/2002 +0930, Brian Schroeder wrote:
>Hi everyone.
>
>I am new to this list, and a real novice with databases.
>
>A while back I created a database using postgres 7.03 in Mandrake 7.2.
>It is a catalog for all my books.
>
>Although not really knowing what I was doing, I have recently upgraded
>it to 7.2 along with Mandrake 8.2.  I did a dump_all from 7.03, and
>then read it all in to psql in 7.2.
>
>When I try to view the database, everything is there and looks OK.  But
>if I try to insert a new entry I get the following error:
>
>ERROR: Relation "books_bookid_seq" does not exist.
>
>Using phpPgadmin shows:
>
>Field    Type   Length  Not Null   Default
>BookId   Int4   4       Yes        nextval('Books_BookID_seq'::text)
>
>What do I need to do?
>
>Brian
>
>_________________________________________________________________
>MSN Photos is the easiest way to share and print your photos:
>http://photos.msn.com/support/worldwide.aspx
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 3: if posting/reading through Usenet, please send an appropriate
>subscribe-nomail command to majordomo@postgresql.org so that your
>message can get through to the mailing list cleanly
>
>

Re: Relation does not exist

From
"Brian Schroeder"
Date:


>From: April L <april@i-netco.com>
>To: "Brian Schroeder" <bjswm@hotmail.com>, pgsql-novice@postgresql.org
>Subject: Re: [NOVICE] Relation does not exist
>Date: Tue, 07 May 2002 23:01:04 -0400
>
>in your queries you have to refer to it with propercase and enclose in "
>quotes
>
>so books_bookid_seq will cause the error
>
>"Books_BookID_seq" will be ok...
>
>I'm also a novice... I don't know what you are doing but here is an example
>of properly referring to a column called Cars in a table called Customers
>like this
>
>"Customers"."Cars"
>
>if you run a windows machine connecting to your pg machine, nice easy
>interface is PGExplorer or PGAdmin. They show you this kind of thing to
>some extent and PGExplorer helps write the syntax to some extent.
>
>- April
>
>At 11:53 AM 5/8/2002 +0930, Brian Schroeder wrote:
> >Hi everyone.
> >
> >I am new to this list, and a real novice with databases.
> >
> >A while back I created a database using postgres 7.03 in Mandrake 7.2.
> >It is a catalog for all my books.
> >
> >Although not really knowing what I was doing, I have recently upgraded
> >it to 7.2 along with Mandrake 8.2.  I did a dump_all from 7.03, and
> >then read it all in to psql in 7.2.
> >
> >When I try to view the database, everything is there and looks OK.  But
> >if I try to insert a new entry I get the following error:
> >
> >ERROR: Relation "books_bookid_seq" does not exist.
> >
> >Using phpPgadmin shows:
> >
> >Field    Type   Length  Not Null   Default
> >BookId   Int4   4       Yes        nextval('Books_BookID_seq'::text)
> >
> >What do I need to do?
> >
> >Brian
> >
> >_________________________________________________________________
> >MSN Photos is the easiest way to share and print your photos:
> >http://photos.msn.com/support/worldwide.aspx
> >
> >
> >---------------------------(end of broadcast)---------------------------
> >TIP 3: if posting/reading through Usenet, please send an appropriate
> >subscribe-nomail command to majordomo@postgresql.org so that your
> >message can get through to the mailing list cleanly
> >
> >




_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


Re: Relation does not exist

From
Tom Lane
Date:
April L <april@i-netco.com> writes:
> in your queries you have to refer to it with propercase and enclose in "
> quotes
> so books_bookid_seq will cause the error
> "Books_BookID_seq" will be ok...

It's been awhile, but I think that 7.0's nextval() would take the given
string literally, while later versions follow the downcase-unless-quoted
rule that applies to names in normal query contexts.  So if you had
    nextval('Books_BookID_seq')
before, you now need
    nextval('"Books_BookID_seq"')

Or you could recreate the sequence with an all-lower-case name...

            regards, tom lane

Re: Relation does not exist

From
"Brian Schroeder"
Date:
Thanks Tom, April for your help.

As soon as I get the chance in the next few days I will look into
your suggestions.

Brian.

>From: Tom Lane <tgl@sss.pgh.pa.us>
>April L <april@i-netco.com> writes:
> > in your queries you have to refer to it with propercase and enclose in "
> > quotes
> > so books_bookid_seq will cause the error
> > "Books_BookID_seq" will be ok...
>
>It's been awhile, but I think that 7.0's nextval() would take the given
>string literally, while later versions follow the downcase-unless-quoted
>rule that applies to names in normal query contexts.  So if you had
>    nextval('Books_BookID_seq')
>before, you now need
>    nextval('"Books_BookID_seq"')
>
>Or you could recreate the sequence with an all-lower-case name...
>
>            regards, tom lane




_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


Re: Relation does not exist

From
"Brian Schroeder"
Date:
Yes, putting the extra " in as Tom suggested has fixed it.

Thankyou.

>From: "Brian Schroeder" <bjswm@hotmail.com>
>
>Thanks Tom, April for your help.
>
>As soon as I get the chance in the next few days I will look into
>your suggestions.
>
>Brian.
>
>>From: Tom Lane <tgl@sss.pgh.pa.us>
>>April L <april@i-netco.com> writes:
>> > in your queries you have to refer to it with propercase and enclose in
>>"
>> > quotes
>> > so books_bookid_seq will cause the error
>> > "Books_BookID_seq" will be ok...
>>
>>It's been awhile, but I think that 7.0's nextval() would take the given
>>string literally, while later versions follow the downcase-unless-quoted
>>rule that applies to names in normal query contexts.  So if you had
>>    nextval('Books_BookID_seq')
>>before, you now need
>>    nextval('"Books_BookID_seq"')
>>
>>Or you could recreate the sequence with an all-lower-case name...
>>
>>            regards, tom lane



_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com