Re: [HACKERS] patches for items from TODO list

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Sergey Ten <sergey(at)sourcelabs(dot)com>
Cc: "'Christopher Kings-Lynne'" <chriskl(at)familyhealth(dot)com(dot)au>, jason(at)sourcelabs(dot)com, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] patches for items from TODO list
Date: 2005-05-28 17:03:52
Message-ID: 200505281703.j4SH3qk14807@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Here is an updated version of the COPY \x patch. It is the first patch
attached.

Also, I realized that if we support \x in COPY, we should also support
\x in strings to the backend. This is the second patch.

Third, I found out that psql has some unusual handling of escaped
numbers. Instead of using \ddd as octal, it has \ddd is decimal, \0ddd
is octal, and \0xddd is decimal. It is basically following the strtol()
rules for an escaped value. This seems confusing and contradicts how
the rest of our system works. I looked at 'bash' and found that it
supports the \000 and \x00 just like C, so I am confused why we have
the current behavior. This patch makes psql consistent with the rest of
our system for back slashes. It does break backward compatibility. It
wouldn't be a big deal to fix, except we document this in the psql
manual page, and that adds confusion.

FYI, here is the current psql behavior:

test=> \set x '\42'
test=> \echo :x
*
test=> \set x '\042'
test=> \echo :x
"
test=> \set x '\0x42'
test=> \echo :x
B

The new behavior is:

test=> \set x '\42'
test=> \echo :x
"
test=> \set x '\042'
test=> \echo :x
"
test=> \set x '\x42'
test=> \echo :x
B

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 3.0 KB
unknown_filename text/plain 5.6 KB
unknown_filename text/plain 2.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-05-28 19:04:46 Re: [HACKERS] patches for items from TODO list
Previous Message Tom Lane 2005-05-28 16:46:29 Re: unsafe use of hash_search(... HASH_ENTER ...)

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-05-28 19:04:46 Re: [HACKERS] patches for items from TODO list
Previous Message Robert Treat 2005-05-28 16:51:23 Re: psql backslash consistency