X-Original-To: pgsql-odbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 754859F9FAC for ; Mon, 28 Aug 2006 21:41:33 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 07109-08 for ; Mon, 28 Aug 2006 21:41:17 -0300 (ADT) X-Greylist: delayed 08:05:46.841416 by SQLgrey- Received: from mail2.pcfruit.com (unknown [65.122.178.131]) by postgresql.org (Postfix) with ESMTP id C80BF9F931A for ; Mon, 28 Aug 2006 21:41:17 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail2.pcfruit.com (Postfix) with ESMTP id 0A9DE77932; Mon, 28 Aug 2006 17:40:52 -0700 (PDT) X-Virus-Scanned: amavisd-new at pcfruit.com Received: from mail2.pcfruit.com ([127.0.0.1]) by localhost (mail2.pcfruit.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KdYHhVHhnhIV; Mon, 28 Aug 2006 17:40:44 -0700 (PDT) Received: from [192.168.1.14] (pcf0003.pcfruit.com [192.168.1.14]) by mail2.pcfruit.com (Postfix) with ESMTP id EDC92190D79; Mon, 28 Aug 2006 17:40:43 -0700 (PDT) Message-ID: <44F38D39.8000707@pcfruit.com> Date: Mon, 28 Aug 2006 17:41:29 -0700 From: Avery Payne User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: aklaver@comcast.net Cc: pgsql-odbc@postgresql.org, ALVARO ARCILA Subject: Re: Visual FoxPro, PostgreSQL, and Dates (Long) References: <44F31B58.40200@pcfruit.com> <200608281136.17351.aklaver@comcast.net> In-Reply-To: <200608281136.17351.aklaver@comcast.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200608/123 X-Sequence-Number: 8087 >>>> [ many helpful replies and suggestions snipped, see the thread] >>>> >>>> My question is simple: how hard would it be to extend the ODBC driver >>>> slightly to include three new options? The options would take the >>>> form of three radio buttons under a single heading, "Empty Date >>>> Handling", and would allow for the following options: (A) No-Op, >>>> which would do nothing new (the driver continues to operate as it >>>> currently does, and empty dates are flagged as errors), (B) NULL >>>> Conversion, which treats all "empty" dates as NULLs, and all NULL >>>> date values are converted to "empty" when retrieved (this would make >>>> FoxPro happy, and would probably also work well with Access, Paradox, >>>> dBase, etc as they allow for empty date fields as well), (C) Set to >>>> User-Defined, which would allow the user to enter a specific date >>>> value into a text box. When an empty date is encountered, it is >>>> replaced with this value. Data retrieval is unaffected because the >>>> value retrieved is valid for both systems. >>>> >>>> [more stuff snipped] >>>> > > For some possible solutions short of changing the ODBC driver see message > below. Message also explains why a BEFORE trigger will not work as suggested > above. > http://archives.postgresql.org/pgsql-general/2003-06/msg00713.php > Thanks for your reply. After reading the thread you provided, it seems that petitioning to add the "Empty-Date-to-NULL" functionality to the ODBC driver would be the right thing to do. It should be a fairly simple modification as we are literally replacing ''::date in the output string to the server in all cases when the option is enabled, and doing nothing when disabled. This should not interfere with ANY other situation (because by default someone passing ''::date to the server is going to error out *anyway* because it's ALWAYS invalid for ALL cases, UPDATE will need this to apply, INSERT would apply, SELECT/DELETE would be nonsensical, etc.) and I believe that the ODBC driver is already returning NULL date fields as "empties" from SELECT statements when used in FoxPro, etc. So adding this simple code with a switch to turn it off/on would not only solve the issue, but as I mentioned earlier, I think it would allow a broader audience of users to move their applications to PostgreSQL via ODBC, without alot of painful code changes. At the same time, PostgreSQL continues to follow it's dictum of not accepting empty dates. It's a win-win for everyone. If I find the time and the correct compiler (I don't have VC++ v6) I'll try to patch it myself and submit it. Thanks again to everyone here for their support and suggestions. This has been very informative and I hope that the ODBC maintainer(s) will consider this petition for a new function.