Обсуждение: stupid insert error

Поиск
Список
Период
Сортировка

stupid insert error

От
David Bear
Дата:
I guess I'm too stupid to see the error, but I don't understand why
the following fails.


insert into person3 (asuid, fname, lname, addedby, addedon,
slopbucket) values ("123455", "name", "name", "entered", "12/12/2004", NULL);
ERROR:  column "123455" does not exist

is the double quote byting me?
--
David Bear
phone:     480-965-8257
fax:     480-965-9189
College of Public Programs/ASU
Wilson Hall 232
Tempe, AZ 85287-0803
 "Beware the IP portfolio, everyone will be suspect of trespassing"

Re: stupid insert error

От
Michael Fuhr
Дата:
On Thu, Jun 23, 2005 at 05:12:03PM -0700, David Bear wrote:
>
> I guess I'm too stupid to see the error, but I don't understand why
> the following fails.
>
> insert into person3 (asuid, fname, lname, addedby, addedon,
> slopbucket) values ("123455", "name", "name", "entered", "12/12/2004", NULL);
> ERROR:  column "123455" does not exist
>
> is the double quote byting me?

String constants use single quotes (or dollar quotes as of 8.0);
double-quoted strings are interpreted as identifiers.  See "Lexical
Structure" in the "SQL Syntax" chapter of the documentation:

http://www.postgresql.org/docs/8.0/static/sql-syntax.html#SQL-SYNTAX-LEXICAL

If I'm not mistaken, this distinction is defined in the SQL standard.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

Re: stupid insert error

От
"Bruno G. Albuquerque"
Дата:
Try single quotes (') instead of double-quotes (").

-Bruno

On Thu, 23 Jun 2005 17:12:03 -0700, David Bear said:

> I guess I'm too stupid to see the error, but I don't understand why
> the following fails.
>
>
> insert into person3 (asuid, fname, lname, addedby, addedon,
> slopbucket) values ("123455", "name", "name", "entered", "12/12/
> 2004", NULL);
> ERROR:  column "123455" does not exist
>
> is the double quote byting me?
> --
> David Bear
> phone:     480-965-8257
> fax:     480-965-9189
> College of Public Programs/ASU
> Wilson Hall 232
> Tempe, AZ 85287-0803
>  "Beware the IP portfolio, everyone will be suspect of trespassing"
>
> ---------------------------(end of broadcast)------------------------
> ---
> TIP 4: Don't 'kill -9' the postmaster


**********************************************************************
Informação transmitida destina-se apenas à pessoa a quem foi endereçada e pode conter informação confidencial,
legalmenteprotegida e para conhecimento exclusivo do destinatário. Se o leitor desta advertência não for o seu
destinatário,fica ciente de que sua leitura, divulgação ou cópia é estritamente proibida. Caso a mensagem tenha sido
recebidapor engano, favor comunicar ao remetente e apagar o texto de qualquer computador. 


The information transmitted is intended only for the person or entity to which it is addressed and may contain
confidentialand/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any
actionin reliance upon this information, by person or entity other than the intended recipient is prohibited. If you
receivedthis in error, please contact the sender and delete the material from any computer. 
**********************************************************************

Re: stupid insert error

От
Tom Lane
Дата:
David Bear <David.Bear@asu.edu> writes:
> I guess I'm too stupid to see the error, but I don't understand why
> the following fails.

> insert into person3 (asuid, fname, lname, addedby, addedon,
> slopbucket) values ("123455", "name", "name", "entered", "12/12/2004", NULL);
> ERROR:  column "123455" does not exist

You want single quotes not double quotes.  Double quotes are for
identifiers, single quotes are for literals.  See
http://www.postgresql.org/docs/8.0/static/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS
and the following section.

            regards, tom lane

Re: stupid insert error

От
"李江华"
Дата:
David Bear,您好!

    yes.of course.
    you should insert the record like this:
    insert into person3 (asuid, fname, lname, addedby, addedon,
    slopbucket) values ('123455', 'name', 'name', 'entered', '12/12/2004', '');

======= 2005-06-24 08:12:03 您在来信中写道:=======

>I guess I'm too stupid to see the error, but I don't understand why
>the following fails.
>
>
>insert into person3 (asuid, fname, lname, addedby, addedon,
>slopbucket) values ("123455", "name", "name", "entered", "12/12/2004", NULL);
>ERROR:  column "123455" does not exist
>
>is the double quote byting me?
>-- 
>David Bear
>phone:     480-965-8257
>fax:     480-965-9189
>College of Public Programs/ASU
>Wilson Hall 232
>Tempe, AZ 85287-0803
> "Beware the IP portfolio, everyone will be suspect of trespassing"
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster
>

= = = = = = = = = = = = = = = = = = = =
            

        致
礼!
 
                 
        李江华
        ljh1469@alibaba-inc.com
          2005-06-24