Re: [HACKERS] Add ENCODING option to COPY

2011-02-08 Thread Peter Eisentraut
On fre, 2011-02-04 at 10:47 -0500, Tom Lane wrote: The reason that we use quotes in CREATE DATABASE is that encoding names aren't assumed to be valid SQL identifiers. If this patch isn't following the CREATE DATABASE precedent, it's the patch that's wrong, not CREATE DATABASE. Since encoding

Re: [HACKERS] Add ENCODING option to COPY

2011-02-08 Thread Tom Lane
Peter Eisentraut pete...@gmx.net writes: On fre, 2011-02-04 at 10:47 -0500, Tom Lane wrote: The reason that we use quotes in CREATE DATABASE is that encoding names aren't assumed to be valid SQL identifiers. If this patch isn't following the CREATE DATABASE precedent, it's the patch that's

Re: [HACKERS] Add ENCODING option to COPY

2011-02-08 Thread Hitoshi Harada
2011/2/9 Tom Lane t...@sss.pgh.pa.us: Peter Eisentraut pete...@gmx.net writes: On fre, 2011-02-04 at 10:47 -0500, Tom Lane wrote: The reason that we use quotes in CREATE DATABASE is that encoding names aren't assumed to be valid SQL identifiers.  If this patch isn't following the CREATE

Re: [HACKERS] Add ENCODING option to COPY

2011-02-08 Thread Peter Eisentraut
On tis, 2011-02-08 at 10:53 -0500, Tom Lane wrote: Peter Eisentraut pete...@gmx.net writes: On fre, 2011-02-04 at 10:47 -0500, Tom Lane wrote: The reason that we use quotes in CREATE DATABASE is that encoding names aren't assumed to be valid SQL identifiers. If this patch isn't following

Re: [HACKERS] Add ENCODING option to COPY

2011-02-07 Thread Robert Haas
On Fri, Feb 4, 2011 at 1:54 PM, Hitoshi Harada umi.tan...@gmail.com wrote: 2011/2/5 Tom Lane t...@sss.pgh.pa.us: Hitoshi Harada umi.tan...@gmail.com writes: 2011/2/5 Tom Lane t...@sss.pgh.pa.us: Yeah, putting backend-only stuff into that header is a nonstarter. Do you mean you think it' all

Re: [HACKERS] Add ENCODING option to COPY

2011-02-07 Thread Hitoshi Harada
2011/2/8 Robert Haas robertmh...@gmail.com: On Fri, Feb 4, 2011 at 1:54 PM, Hitoshi Harada umi.tan...@gmail.com wrote: 2011/2/5 Tom Lane t...@sss.pgh.pa.us: Hitoshi Harada umi.tan...@gmail.com writes: 2011/2/5 Tom Lane t...@sss.pgh.pa.us: Yeah, putting backend-only stuff into that header is a

Re: [HACKERS] Add ENCODING option to COPY

2011-02-04 Thread Hitoshi Harada
2011/2/4 Itagaki Takahiro itagaki.takah...@gmail.com: On Tue, Feb 1, 2011 at 13:08, Hitoshi Harada umi.tan...@gmail.com wrote: The third patch is attached, modifying mb routines so that they can receive conversion procedures as FmgrInof * and save the function pointer in CopyState. I tested

Re: [HACKERS] Add ENCODING option to COPY

2011-02-04 Thread Tom Lane
Itagaki Takahiro itagaki.takah...@gmail.com writes: * Syntax: ENCODING encoding vs. ENCODING 'encoding' We don't have to quote encoding names in the patch, but we always need quotes for CREATE DATABASE WITH ENCODING. I think we should modify CREATE DATABASE to accept unquoted encoding names

Re: [HACKERS] Add ENCODING option to COPY

2011-02-04 Thread Hitoshi Harada
2011/2/5 Tom Lane t...@sss.pgh.pa.us: Itagaki Takahiro itagaki.takah...@gmail.com writes: * Syntax: ENCODING encoding vs. ENCODING 'encoding' We don't have to quote encoding names in the patch, but we always need quotes for CREATE DATABASE WITH ENCODING. I think we should modify CREATE

Re: [HACKERS] Add ENCODING option to COPY

2011-02-04 Thread Tom Lane
Hitoshi Harada umi.tan...@gmail.com writes: 2011/2/5 Tom Lane t...@sss.pgh.pa.us: The reason that we use quotes in CREATE DATABASE is that encoding names aren't assumed to be valid SQL identifiers.  If this patch isn't following the CREATE DATABASE precedent, it's the patch that's wrong, not

Re: [HACKERS] Add ENCODING option to COPY

2011-02-04 Thread Hitoshi Harada
2011/2/5 Tom Lane t...@sss.pgh.pa.us: Hitoshi Harada umi.tan...@gmail.com writes: 2011/2/5 Tom Lane t...@sss.pgh.pa.us: The reason that we use quotes in CREATE DATABASE is that encoding names aren't assumed to be valid SQL identifiers.  If this patch isn't following the CREATE DATABASE

Re: [HACKERS] Add ENCODING option to COPY

2011-02-04 Thread Tom Lane
Hitoshi Harada umi.tan...@gmail.com writes: 2011/2/5 Tom Lane t...@sss.pgh.pa.us: Yeah, putting backend-only stuff into that header is a nonstarter. Do you mean you think it' all right to define pg_cached_encoding_conversion() in pg_conversion_fn.h? That seems pretty random too. I still

Re: [HACKERS] Add ENCODING option to COPY

2011-02-04 Thread Hitoshi Harada
2011/2/5 Tom Lane t...@sss.pgh.pa.us: Hitoshi Harada umi.tan...@gmail.com writes: 2011/2/5 Tom Lane t...@sss.pgh.pa.us: Yeah, putting backend-only stuff into that header is a nonstarter. Do you mean you think it' all right to define pg_cached_encoding_conversion() in pg_conversion_fn.h?

Re: [HACKERS] Add ENCODING option to COPY

2011-02-03 Thread Itagaki Takahiro
On Tue, Feb 1, 2011 at 13:08, Hitoshi Harada umi.tan...@gmail.com wrote: The third patch is attached, modifying mb routines so that they can receive conversion procedures as FmgrInof * and save the function pointer in CopyState. I tested it with encoding option and could not see performance

Re: [HACKERS] Add ENCODING option to COPY

2011-01-31 Thread Hitoshi Harada
2011/1/31 Hitoshi Harada umi.tan...@gmail.com: 2011/1/31 Robert Haas robertmh...@gmail.com: On Tue, Jan 25, 2011 at 10:24 AM, Hitoshi Harada umi.tan...@gmail.com wrote: I'll check the code more if we have better alternatives. Where are we with this? I'll post another version today.

Re: [HACKERS] Add ENCODING option to COPY

2011-01-31 Thread Tom Lane
Hitoshi Harada umi.tan...@gmail.com writes: Finally I concluded the concern Itagaki-san raised can be solved by adding code that restores client_encoding in copy_in_error_callback. That seems like an absolutely horrid idea. Error context callbacks should not have side-effects like that.

Re: [HACKERS] Add ENCODING option to COPY

2011-01-31 Thread Hitoshi Harada
2011/2/1 Tom Lane t...@sss.pgh.pa.us: Hitoshi Harada umi.tan...@gmail.com writes: Finally I concluded the concern Itagaki-san raised can be solved by adding code that restores client_encoding in copy_in_error_callback. It might happen to work today (or at least in the scenarios you tested),

Re: [HACKERS] Add ENCODING option to COPY

2011-01-31 Thread Hitoshi Harada
2011/2/1 Hitoshi Harada umi.tan...@gmail.com: 2011/2/1 Tom Lane t...@sss.pgh.pa.us: Hitoshi Harada umi.tan...@gmail.com writes: Finally I concluded the concern Itagaki-san raised can be solved by adding code that restores client_encoding in copy_in_error_callback. It might happen to work

Re: [HACKERS] Add ENCODING option to COPY

2011-01-30 Thread Robert Haas
On Tue, Jan 25, 2011 at 10:24 AM, Hitoshi Harada umi.tan...@gmail.com wrote: I'll check the code more if we have better alternatives. Where are we with this? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list

Re: [HACKERS] Add ENCODING option to COPY

2011-01-30 Thread Hitoshi Harada
2011/1/31 Robert Haas robertmh...@gmail.com: On Tue, Jan 25, 2011 at 10:24 AM, Hitoshi Harada umi.tan...@gmail.com wrote: I'll check the code more if we have better alternatives. Where are we with this? I'll post another version today. Regards, -- Hitoshi Harada -- Sent via pgsql-hackers

Re: [HACKERS] Add ENCODING option to COPY

2011-01-25 Thread Hitoshi Harada
2011/1/25 Itagaki Takahiro itagaki.takah...@gmail.com: On Sat, Jan 15, 2011 at 02:25, Hitoshi Harada umi.tan...@gmail.com wrote: The patch overrides client_encoding by the added ENCODING option, and restores it as soon as copy is done. We cannot do that because error messages should be

Re: [HACKERS] Add ENCODING option to COPY

2011-01-24 Thread Itagaki Takahiro
On Sat, Jan 15, 2011 at 02:25, Hitoshi Harada umi.tan...@gmail.com wrote: The patch overrides client_encoding by the added ENCODING option, and restores it as soon as copy is done. We cannot do that because error messages should be encoded in the original encoding even during COPY commands with