Re: How to insert Ecoded values into postrgresql

Lists: pgsql-general
From: venkat <ven(dot)tammineni(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How to insert Ecoded values into postrgresql
Date: 2010-04-14 10:51:56
Message-ID: w2h79ad14901004140351s7aaa854ambbd19e080c5be370@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Dear All,

How to insert encoded data that is(/\_+(at)#$%^&*)(_+) something like
that....I have Csv file .Which contains encoded values.when i try to insert
those. I am getting error..I am not able to insert encoded data.Please
anyone guide me.

I am waiting for your great response.

Thanks and Regards,

Ven


From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: venkat <ven(dot)tammineni(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to insert Ecoded values into postrgresql
Date: 2010-04-14 14:04:39
Message-ID: s2ub42b73151004140704lfd830ec0p19f055878c9dabe4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Wed, Apr 14, 2010 at 6:51 AM, venkat <ven(dot)tammineni(at)gmail(dot)com> wrote:
> Dear All,
>
>    How to insert encoded data that is(/\_+(at)#$%^&*)(_+) something like
> that....I have Csv file .Which contains encoded values.when i try to insert
> those. I am getting error..I am not able to insert encoded data.Please
> anyone guide me.

*) how are you loading your csv file? with copy?

*) is your file properly csv formatted to a particular standard? (such
as rfc4180)

aside: anyone know if postgres properly handles csv according to rfc4180?

merlin


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: venkat <ven(dot)tammineni(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to insert Ecoded values into postrgresql
Date: 2010-04-15 03:07:30
Message-ID: 201004150307.o3F37UR18348@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Merlin Moncure wrote:
> On Wed, Apr 14, 2010 at 6:51 AM, venkat <ven(dot)tammineni(at)gmail(dot)com> wrote:
> > Dear All,
> >
> > ?? How to insert encoded data that is(/\_+(at)#$%^&*)(_+) something like
> > that....I have Csv file .Which contains encoded values.when i try to insert
> > those. I am getting error..I am not able to insert encoded data.Please
> > anyone guide me.
>
> *) how are you loading your csv file? with copy?
>
> *) is your file properly csv formatted to a particular standard? (such
> as rfc4180)
>
> aside: anyone know if postgres properly handles csv according to rfc4180?

Wow, I had no idea there was an RFC for CSV. Could you test and tell us
how we compare --- that would be a good thing to document.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, venkat <ven(dot)tammineni(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to insert Ecoded values into postrgresql
Date: 2010-04-15 04:29:21
Message-ID: 22709.1271305761@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Merlin Moncure wrote:
>> aside: anyone know if postgres properly handles csv according to rfc4180?

> Wow, I had no idea there was an RFC for CSV.

Me either. I'd bet the percentage of "CSV"-using programs that actually
conform to the RFC is very small anyway; so while it might be smart to
make sure that what we *emit* follows the RFC, it's probably useless as
a guide to what we need to *accept*.

regards, tom lane


From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, venkat <ven(dot)tammineni(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to insert Ecoded values into postrgresql
Date: 2010-04-15 13:53:37
Message-ID: y2mb42b73151004150653n5199a7a2m49e2feb42961842b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Thu, Apr 15, 2010 at 12:29 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
>> Merlin Moncure wrote:
>>> aside: anyone know if postgres properly handles csv according to rfc4180?
>
>> Wow, I had no idea there was an RFC for CSV.
>
> Me either.  I'd bet the percentage of "CSV"-using programs that actually
> conform to the RFC is very small anyway; so while it might be smart to
> make sure that what we *emit* follows the RFC, it's probably useless as
> a guide to what we need to *accept*.

Well, we would have to accept it if we emit it, but you're right.
Kinda like how with base64 encoding there are two competing
incompatible (both RFC) standards of doing it. We accept both but
only emit one. I'll look at how we handle csv. I've always been
curious about that actually. If a standard exists and it isn't
completely insane maybe we should document and encourage it.

merlin


From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to insert Ecoded values into postrgresql
Date: 2010-04-18 11:33:25
Message-ID: hqeqm5$u3e$1@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On 2010-04-14, venkat <ven(dot)tammineni(at)gmail(dot)com> wrote:
> --0016362845f4b36d220484302ab7
> Content-Type: text/plain; charset=ISO-8859-1
>
> Dear All,
>
> How to insert encoded data that is(/\_+(at)#$%^&*)(_+) something like
> that....I have Csv file .Which contains encoded values.when i try to insert
> those. I am getting error..I am not able to insert encoded data.Please
> anyone guide me.

Postgresql can read CSV.

else you probably want pg_escape_string or similar.


From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, venkat <ven(dot)tammineni(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to insert Ecoded values into postrgresql
Date: 2010-04-19 16:46:41
Message-ID: x2yb42b73151004190946y7530a652pc7c4dac0e2d7bde5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Thu, Apr 15, 2010 at 12:29 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
>> Merlin Moncure wrote:
>>> aside: anyone know if postgres properly handles csv according to rfc4180?
>
>> Wow, I had no idea there was an RFC for CSV.
>
> Me either.  I'd bet the percentage of "CSV"-using programs that actually
> conform to the RFC is very small anyway; so while it might be smart to
> make sure that what we *emit* follows the RFC, it's probably useless as
> a guide to what we need to *accept*.

I took a quick look at the rfc. It's very short and appears to codify
common practices. We follow it for both input and output except:

*) trailing spaces are supposed to preserved. we follow sql rules on
trailing spaces which I think makes this point moot.

*) csv is supposed to be CRLF *always*. We do not do this. We do
however read different types of newlines. So we are a 4180 reader but
not an emitter. Not so sure if I think changing this is a good idea
though without exposing a knob.

merlin


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, venkat <ven(dot)tammineni(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to insert Ecoded values into postrgresql
Date: 2010-04-19 17:06:37
Message-ID: 17204.1271696797@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
> *) csv is supposed to be CRLF *always*. We do not do this. We do
> however read different types of newlines. So we are a 4180 reader but
> not an emitter. Not so sure if I think changing this is a good idea
> though without exposing a knob.

Given the lack of field complaints, I think changing this would be a
pretty terrible idea; much more likely to break things than fix them.
It's not like that RFC has huge recognition as The Standard.

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, venkat <ven(dot)tammineni(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to insert Ecoded values into postrgresql
Date: 2010-04-20 14:55:29
Message-ID: 201004201455.o3KEtT915911@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Tom Lane wrote:
> Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
> > *) csv is supposed to be CRLF *always*. We do not do this. We do
> > however read different types of newlines. So we are a 4180 reader but
> > not an emitter. Not so sure if I think changing this is a good idea
> > though without exposing a knob.
>
> Given the lack of field complaints, I think changing this would be a
> pretty terrible idea; much more likely to break things than fix them.
> It's not like that RFC has huge recognition as The Standard.

Should we document we support the standard?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, venkat <ven(dot)tammineni(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to insert Ecoded values into postrgresql
Date: 2010-04-20 15:07:54
Message-ID: 7568.1271776074@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Tom Lane wrote:
>> Given the lack of field complaints, I think changing this would be a
>> pretty terrible idea; much more likely to break things than fix them.
>> It's not like that RFC has huge recognition as The Standard.

> Should we document we support the standard?

I'm inclined to think not: there's no evidence that anyone cares about
compliance to that RFC, and anyway we *don't* support the standard
exactly, per Merlin's report. We'd have to say something like "we
support the standard except for line-endings", which is only going to
muddy the waters.

regards, tom lane