Обсуждение: quoting problem?

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

quoting problem?

От
Terry Mackintosh
Дата:
Hi all

I am running an older snapshoot of 6.4, so this may not be relavent now.

I did a 'pg_dumpall -z > file.dump', then on another box destroyed all the
databases and did 'psql templet1 < file.dump' and got this:

REVOKE ALL on 'board' from PUBLIC;
ERROR:  parser: parse error at or near "'"
GRANT ALL on "board" to "nobody";
CHANGE

It would seem that the single quotes should be double quotes?
Jan, is this your area?

I have notice that most all names now are quoted in dumps, but will work
just fine with out any quotes, so why the quotes?

Thanks, and have a great day
Terry Mackintosh <terry@terrym.com>          http://www.terrym.com
sysadmin/owner  Please! No MIME encoded or HTML mail, unless needed.

Proudly powered by R H Linux 4.2, Apache 1.3, PHP 3, PostgreSQL 6.3
-------------------------------------------------------------------
Success Is A Choice ... book by Rick Patino, get it, read it!



Re: [HACKERS] quoting problem?

От
"Thomas G. Lockhart"
Дата:
> REVOKE ALL on 'board' from PUBLIC;
> ERROR:  parser: parse error at or near "'"
> GRANT ALL on "board" to "nobody";
> CHANGE
> It would seem that the single quotes should be double quotes?

It looks like that is now correct in the v6.4beta and v6.4final trees.
The program uses a single function, FmtId(), to evaluate strings and to
do the quote/noquote thang.

> I have notice that most all names now are quoted in dumps, but will 
> work just fine with out any quotes, so why the quotes?

The primary reason that is that you are allowed on table creation to use
reserved keywords if you surround them with double quotes. pg_dump
doesn't know about reserved words, so would not be able to selectively
apply double quotes.

You can suppress most of the double quotes by using the new "-n"
argument to pg_dump (n == no quotes). This gives you essentially the old
behavior of applying double quotes only if there is upper case or
whitespace in the identifier.
                 - Tom


Re: [HACKERS] quoting problem?

От
jwieck@debis.com (Jan Wieck)
Дата:
>
> Hi all
>
> I am running an older snapshoot of 6.4, so this may not be relavent now.
>
> I did a 'pg_dumpall -z > file.dump', then on another box destroyed all the
> databases and did 'psql templet1 < file.dump' and got this:
>
> REVOKE ALL on 'board' from PUBLIC;
> ERROR:  parser: parse error at or near "'"
> GRANT ALL on "board" to "nobody";
> CHANGE
>
> It would seem that the single quotes should be double quotes?
> Jan, is this your area?

    Not  my  area.  But  I'll  take  care  that it get's fixed in
    v6.4.1.

>
> I have notice that most all names now are quoted in dumps, but will work
> just fine with out any quotes, so why the quotes?

    Just for the case that  some  of  the  identifiers  could  be
    reserved  words  or  contain  upper  case letters. By default
    (without quotes), the parser changes anything to  lower  case
    and does keyword lookup.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #