X-Original-To: pgsql-general@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E7FE447636C for ; Thu, 24 Apr 2003 17:32:04 -0400 (EDT) Received: from ms-smtp-01.tampabay.rr.com (ms-smtp-01.tampabay.rr.com [65.32.1.43]) by postgresql.org (Postfix) with ESMTP id C8B8A476344 for ; Thu, 24 Apr 2003 17:32:03 -0400 (EDT) Received: from mattspc (169-52.34-65.tampabay.rr.com [65.34.52.169]) by ms-smtp-01.tampabay.rr.com (8.12.5/8.12.5) with ESMTP id h3OLVbon006424; Thu, 24 Apr 2003 17:31:37 -0400 (EDT) From: "Matthew Nuzum" To: "'Robert Treat'" Cc: "'Josh Berkus'" , , Subject: Re: [SQL] rewriting values with before trigger Date: Thu, 24 Apr 2003 17:31:33 -0400 Organization: Bearfruit.org Message-ID: <006e01c30aa8$e1183770$6900a8c0@mattspc> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Importance: Normal In-Reply-To: <1051213745.4752.572.camel@camel> X-Spam-Status: No, hits=-12.2 required=5.0 tests=BAYES_10,IN_REP_TO,QUOTED_EMAIL_TEXT autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/1281 X-Sequence-Number: 41346 I'm by no means an expert in this, but maybe this idea would work in your rule? Write a function that takes text as it's input and returns either a timestamp or NULL and then do something like: return_timestamp(mydate::text) This way, a valid date will be converted to it's text equiv. You can then use the function to look for '' and if true, return NULL and if false cast the text string back into a timestamp or whatever and return it. Of course, I don't know if a function that is set to return a timestamp can even return NULL. That might cause an error by itself. -- Matthew Nuzum www.bearfruit.org cobalt@bearfruit.org > -----Original Message----- > From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql- > owner@postgresql.org] On Behalf Of Robert Treat > Sent: Thursday, April 24, 2003 3:49 PM > To: gearond@cvc.net > Cc: Josh Berkus; pgsql-general@postgresql.org; pgsql-sql@postgresql.org > Subject: Re: [GENERAL] [SQL] rewriting values with before trigger > > On Thu, 2003-04-24 at 15:35, Dennis Gearon wrote: > > Well, > > does ''::INT do anything valuable? > > not in 7.3+, and given my original problem involves timestamps, not > in > 7.2 either. > > > change column to a string, convert to INTS on the way out, STRINGS > on the way in? > > use an external language to make transitions. > > > > yeah, I've thought of some other crazy ways to get around this, but the > problem is due to a bug in the application side. I was hoping I could > write a quick hack (like adding a rule/trigger) to get around this until > the app was fixed, but I'm not going to make my side a kludge when it > isn't one now. > > > Robert Treat > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster