Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-11 Thread Robert Haas
On Fri, Oct 11, 2013 at 12:49 AM, Amit Kapila amit.kapil...@gmail.com wrote: On Thu, Oct 10, 2013 at 6:45 PM, Andrew Dunstan and...@dunslane.net wrote: On 10/09/2013 11:47 PM, Amit Kapila wrote: One of the advantage, I could see using NULL For .. syntax is that already we have one

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-10 Thread Andrew Dunstan
On 10/09/2013 11:47 PM, Amit Kapila wrote: One of the advantage, I could see using NULL For .. syntax is that already we have one syntax with which user can specify what strings can be replaced with NULL, now just to handle quoted empty string why to add different syntax. FORCE_NULL has

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-10 Thread Amit Kapila
On Thu, Oct 10, 2013 at 6:45 PM, Andrew Dunstan and...@dunslane.net wrote: On 10/09/2013 11:47 PM, Amit Kapila wrote: One of the advantage, I could see using NULL For .. syntax is that already we have one syntax with which user can specify what strings can be replaced with NULL, now

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-09 Thread Amit Kapila
On Wed, Oct 9, 2013 at 9:15 AM, Amit Kapila amit.kapil...@gmail.com wrote: On Tue, Oct 8, 2013 at 6:03 PM, Andrew Dunstan and...@dunslane.net wrote: On 10/07/2013 11:34 PM, Amit Kapila wrote: On Tue, Oct 8, 2013 at 12:55 AM, Andrew Dunstan and...@dunslane.net wrote: On 10/07/2013 03:06 PM,

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-09 Thread Andrew Dunstan
On 10/09/2013 09:22 AM, Amit Kapila wrote: On Wed, Oct 9, 2013 at 9:15 AM, Amit Kapila amit.kapil...@gmail.com wrote: On Tue, Oct 8, 2013 at 6:03 PM, Andrew Dunstan and...@dunslane.net wrote: On 10/07/2013 11:34 PM, Amit Kapila wrote: On Tue, Oct 8, 2013 at 12:55 AM, Andrew Dunstan

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-09 Thread Dimitri Fontaine
Andrew Dunstan and...@dunslane.net writes: I don't see at all that your suggested alternative has any advantages over what's been written. If you can say NULL FOR (foo) as '' how will you specify the null for some other column(s)? Are we going to have multiple such clauses? It looks like a

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-09 Thread Andrew Dunstan
On 10/09/2013 11:23 AM, Dimitri Fontaine wrote: Andrew Dunstan and...@dunslane.net writes: I don't see at all that your suggested alternative has any advantages over what's been written. If you can say NULL FOR (foo) as '' how will you specify the null for some other column(s)? Are we going to

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-09 Thread David Fetter
On Wed, Oct 09, 2013 at 09:52:29AM -0400, Andrew Dunstan wrote: On 10/09/2013 09:22 AM, Amit Kapila wrote: On Wed, Oct 9, 2013 at 9:15 AM, Amit Kapila amit.kapil...@gmail.com wrote: On Tue, Oct 8, 2013 at 6:03 PM, Andrew Dunstan and...@dunslane.net wrote: On 10/07/2013 11:34 PM, Amit Kapila

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-09 Thread Andrew Dunstan
On 10/09/2013 01:25 PM, David Fetter wrote: Idea: NULL FOR (foo,bar,baz,blurf) AS '', NULL FOR (quux,fleeg) AS ..., What's the point of this? How is this superior to what is currently proposed? Having arbitrary NULL markers for different fields will significantly increase code

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-09 Thread Robert Haas
On Wed, Oct 9, 2013 at 9:52 AM, Andrew Dunstan and...@dunslane.net wrote: I really don't know what you're saying here. Here is the situation we have today (assuming the default null marker of empty-string): default: empty-string - null, quoted-empty-string - emptystring with

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-09 Thread Andrew Dunstan
On 10/09/2013 03:25 PM, Robert Haas wrote: Therefore, a user who wants the opposite of the default behavior - namely, unquoted empty strings as empty strings and quoted empty strings as nulls - should specify both FORCE NULL and FORCE NOT NULL. Is there a real world example of this case? How

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-09 Thread Robert Haas
On Wed, Oct 9, 2013 at 5:43 PM, Andrew Dunstan and...@dunslane.net wrote: On 10/09/2013 03:25 PM, Robert Haas wrote: Therefore, a user who wants the opposite of the default behavior - namely, unquoted empty strings as empty strings and quoted empty strings as nulls - should specify both FORCE

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-09 Thread Andrew Dunstan
On 10/09/2013 08:39 PM, Robert Haas wrote: On Wed, Oct 9, 2013 at 5:43 PM, Andrew Dunstan and...@dunslane.net wrote: On 10/09/2013 03:25 PM, Robert Haas wrote: Therefore, a user who wants the opposite of the default behavior - namely, unquoted empty strings as empty strings and quoted empty

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-09 Thread Amit Kapila
On Wed, Oct 9, 2013 at 7:22 PM, Andrew Dunstan and...@dunslane.net wrote: On 10/09/2013 09:22 AM, Amit Kapila wrote: On Wed, Oct 9, 2013 at 9:15 AM, Amit Kapila amit.kapil...@gmail.com wrote: On Tue, Oct 8, 2013 at 6:03 PM, Andrew Dunstan and...@dunslane.net wrote: On 10/07/2013 11:34

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-08 Thread Andrew Dunstan
On 10/07/2013 11:34 PM, Amit Kapila wrote: On Tue, Oct 8, 2013 at 12:55 AM, Andrew Dunstan and...@dunslane.net wrote: On 10/07/2013 03:06 PM, Robert Haas wrote: Also if your use case is to treat empty strings as NULL (as per above documentation), can't it be handled with WITH NULL AS

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-08 Thread Robert Haas
On Tue, Oct 8, 2013 at 8:33 AM, Andrew Dunstan and...@dunslane.net wrote: On 10/07/2013 11:34 PM, Amit Kapila wrote: On Tue, Oct 8, 2013 at 12:55 AM, Andrew Dunstan and...@dunslane.net wrote: On 10/07/2013 03:06 PM, Robert Haas wrote: Also if your use case is to treat empty strings as NULL

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-08 Thread Andrew Dunstan
On 10/08/2013 12:30 PM, Robert Haas wrote: On Tue, Oct 8, 2013 at 8:33 AM, Andrew Dunstan and...@dunslane.net wrote: On 10/07/2013 11:34 PM, Amit Kapila wrote: On Tue, Oct 8, 2013 at 12:55 AM, Andrew Dunstan and...@dunslane.net wrote: On 10/07/2013 03:06 PM, Robert Haas wrote: Also if your

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-08 Thread Andrew Dunstan
On 10/08/2013 12:47 PM, Andrew Dunstan wrote: On 10/08/2013 12:30 PM, Robert Haas wrote: Andrew, are you planning to review commit this? Yes. Incidentally, the patch doesn't seem to add the option to file_fdw, which I really think it should. cheers andrew -- Sent via

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-08 Thread Ian Lawrence Barwick
2013/10/9 Andrew Dunstan and...@dunslane.net: On 10/08/2013 12:47 PM, Andrew Dunstan wrote: On 10/08/2013 12:30 PM, Robert Haas wrote: Andrew, are you planning to review commit this? Yes. Incidentally, the patch doesn't seem to add the option to file_fdw, which I really think it

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-08 Thread Amit Kapila
On Tue, Oct 8, 2013 at 6:03 PM, Andrew Dunstan and...@dunslane.net wrote: On 10/07/2013 11:34 PM, Amit Kapila wrote: On Tue, Oct 8, 2013 at 12:55 AM, Andrew Dunstan and...@dunslane.net wrote: On 10/07/2013 03:06 PM, Robert Haas wrote: Also if your use case is to treat empty strings as

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-07 Thread Robert Haas
On Sat, Oct 5, 2013 at 7:38 AM, Amit Kapila amit.kapil...@gmail.com wrote: On Sun, Sep 29, 2013 at 1:39 PM, Ian Lawrence Barwick barw...@gmail.com wrote: Hi, This patch implements the following TODO item: Allow COPY in CSV mode to control whether a quoted zero-length string is treated

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-07 Thread Andrew Dunstan
On 10/07/2013 03:06 PM, Robert Haas wrote: Also if your use case is to treat empty strings as NULL (as per above documentation), can't it be handled with WITH NULL AS option. For example, something like: postgres=# COPY testnull FROM stdin with CSV NULL AS E''; Enter data to be copied

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-07 Thread Amit Kapila
On Tue, Oct 8, 2013 at 12:55 AM, Andrew Dunstan and...@dunslane.net wrote: On 10/07/2013 03:06 PM, Robert Haas wrote: Also if your use case is to treat empty strings as NULL (as per above documentation), can't it be handled with WITH NULL AS option. For example, something like: postgres=#

Re: [HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-10-05 Thread Amit Kapila
On Sun, Sep 29, 2013 at 1:39 PM, Ian Lawrence Barwick barw...@gmail.com wrote: Hi, This patch implements the following TODO item: Allow COPY in CSV mode to control whether a quoted zero-length string is treated as NULL Currently this is always treated as a zero-length string,

[HACKERS] Patch: FORCE_NULL option for copy COPY in CSV mode

2013-09-29 Thread Ian Lawrence Barwick
Hi, This patch implements the following TODO item: Allow COPY in CSV mode to control whether a quoted zero-length string is treated as NULL Currently this is always treated as a zero-length string, which generates an error when loading into an integer column Re: