Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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

In response to

Responses

pgsql-hackers by date

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

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group