X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 85B238B9B5D for ; Tue, 22 Feb 2005 22:06:05 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29332-09 for ; Tue, 22 Feb 2005 22:06:00 +0000 (GMT) Received: from mail1.elevating.com (wsip-68-99-77-237.tu.ok.cox.net [68.99.77.237]) by svr1.postgresql.org (Postfix) with ESMTP id 729DD8B9D5F for ; Tue, 22 Feb 2005 22:06:01 +0000 (GMT) Received: from bretsony.brets.elevating.com (bretsony.brets.elevating.com [10.23.0.139]) by mail1.elevating.com (8.11.6/8.11.6) with ESMTP id j1MM5GK19707; Tue, 22 Feb 2005 16:05:16 -0600 Subject: Re: how can I query for unset timestamps From: Bret Hughes To: "Gregory S. Williamson" Cc: postgresql sql list In-Reply-To: <71E37EF6B7DCC1499CEA0316A256832801D4BE98@loki.wc.globexplorer.net> References: <71E37EF6B7DCC1499CEA0316A256832801D4BE98@loki.wc.globexplorer.net> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 (1.0.8-9.7x.1) Date: 22 Feb 2005 16:05:16 -0600 Message-Id: <1109109916.3872.125.camel@bretsony> Mime-Version: 1.0 X-Elevating-MailScanner: Found to be clean X-Elevating-MailScanner-SpamCheck: not spam, SpamAssassin (score=-1.5, required 5, BAYES_00 -1.50) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/255 X-Sequence-Number: 20366 Well, thank you very much. works perfectly, I guess I have not done much NULL value stuff. Bret On Tue, 2005-02-22 at 15:19, Gregory S. Williamson wrote: > Bret -- > A test for NULL uses the IS statement, e.g.: > > SELECT * FROM tablefoo WHERE last_timestamp IS NULL; > > HTH, > > Greg Williamson > DBA > GlobeXPlorer LLC > > -----Original Message----- > From: Bret Hughes [mailto:bhughes@elevating.com] > Sent: Tue 2/22/2005 1:09 PM > To: postgresql sql list > Cc: > Subject: [SQL] how can I query for unset timestamps > I have a table that I recently altered by adding several timestamp > columns. I would like to query the table for those rows for which the > timestamp has not been set but am unable to find a way to do so. any > tips ? in psql the column appears empty and char_length returns > nothing. > > Some of what I have tried > > "" -> not valid > > char_length(last_timestamp) > 0 -> returns the rows with the time > stamps > > where NOT char_length(last_timestamp) > 0 -> returns 0 rows > > where NOT (char_length(last_timestamp) > 0 ) -> returns 0 rows > > where last_timestamp = NULL; -> 0 rows > > this is kicking my butt, and starting to piss me off so if any one has > tips I would appreciate it. > > Bret > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > > !DSPAM:421b9fba271461201672223! > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings