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

Re: bytea and text

From: Bob McConnell <rmcconne(at)lightlink(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: bytea and text
Date: 2009-11-28 13:19:15
Message-ID: 4B112353.1020507@lightlink.com (view raw or flat)
Thread:
Lists: pgsql-novice
Syan Tan wrote:
> here's a quote from the postgresql documentation
> 
> Backslash characters (\) can be used in the COPY data to quote data
> characters that might otherwise be taken as row or column delimiters.
> In particular, the following characters must be preceded by a
> backslash if they appear as part of a column value: backslash itself,
> newline, carriage return, and the current delimiter character.
> 
> So if I scan a field value ( say a big buffer to hold an entire
> image), and have a second buffer to copy an escaped image string to ,
> and I read one of the 4 characters mentioned above, and insert a
> backslash into the destination buffer, and then continue copying into
> the second buffer, I should end up with a string that I can put
> inside a comma-separated text file ( so comma = the current delimiter
> character ), and then I can bulk load a huge text file containing
> thousands of images without problems using COPY..FROM , is that 
> correct ?
> 
> 
> On Sat 28/11/09 01:29 , "Tom Lane" tgl(at)sss(dot)pgh(dot)pa(dot)us sent:
>> richard terry <rterry@ pacific.net.au> writes:> tom, I wonder if
>> you could give us a sample of using client side lo_creat , > insert
>> functions to insert a blob into postgres - in an sql statement. 
>> There's an example program in the docs: 
>> http://www.postgresql.org/docs/8.4/static/lo-examplesect.html 
>> regards, tom lane

It is my understanding that the current SQL standard defines the single 
quote as the official escape character. While the DB engine accepts 
others, wouldn't it be best to use the official character?

Bob McConnell
N2SPP


In response to

pgsql-novice by date

Next:From: Tim ClarkDate: 2009-11-29 04:57:15
Subject: Problem loading data from Intro to Postgis
Previous:From: Syan TanDate: 2009-11-28 06:24:15
Subject: Re: bytea and text

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