Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 252BF633D6D for ; Tue, 7 Jul 2009 06:27:04 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 00650-04-7 for ; Tue, 7 Jul 2009 06:26:52 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f205.google.com (mail-fx0-f205.google.com [209.85.220.205]) by mail.postgresql.org (Postfix) with ESMTP id 3AF3C633D71 for ; Tue, 7 Jul 2009 06:26:51 -0300 (ADT) Received: by fxm1 with SMTP id 1so665299fxm.19 for ; Tue, 07 Jul 2009 02:26:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=lCjyXpWzDZkQIMYQD7rilrKPL9ClZB7eq7wSM4nSvAY=; b=G5duhKkF5BjpF9UzhazWMnuR/EfG98yq34FIACpdrQ2YJI1sDDuDsitkMIP5cq+EWC f2+QwEzj76DYajot4Wysm3Yb7CrbjrX3WxUntsiaUNtmTMQoVS7p6kyyEPqmU//rHpzT iF9412MBZdTePHb3XlYhrGBa6uwrLc/+aLe0Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=Dbu4t6gLlyXeUxWwVmb0Fr6UNJQqQiK+yRzMdsKmdHlT11ogYA0VdlyCMsaS3j+GIZ fH27/j5N9guRzsdSl42uJffnVdKcNtBB6xqcYNCtsWt7AvFHhyc4Vkbk8HIMvFbePYPB 00/TQVNc0XE/xJM8mgDby+NFPtf+T0+i/OgC8= MIME-Version: 1.0 Received: by 10.103.197.17 with SMTP id z17mr3218030mup.19.1246958810216; Tue, 07 Jul 2009 02:26:50 -0700 (PDT) In-Reply-To: <1246958222.3874.129.camel@ebony.2ndQuadrant> References: <71F491F5DA99604A80DE49424BF3D02B0C089039@exchange8.actuate.com> <1246958222.3874.129.camel@ebony.2ndQuadrant> From: Greg Stark Date: Tue, 7 Jul 2009 10:26:30 +0100 X-Google-Sender-Auth: c4e40520c59b246b Message-ID: <407d949e0907070226p723915c1u8c74a64b4d66593@mail.gmail.com> Subject: Re: Best way to simulate Booleans To: Simon Riggs Cc: Scott Marlowe , Peter Headland , pgsql-sql@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200907/29 X-Sequence-Number: 32770 On Tue, Jul 7, 2009 at 10:17 AM, Simon Riggs wrote: > > > Integer works best since it converts easily to boolean > > mybool smallint check (mybool in (0, 1)) > > You can use "char" also, but the syntax is less clear. Hm, I was going to suggest using boolean in postgres and making a "boolean" domain in Oracle for char(1) and then write all sql to compare with = 'f' and = 't'. It's annoying you can't use "WHERE foo_flag" and have to write "WHERE foo_flag = 't'" but otherwise that would give you the same sql in both flavours. -- greg http://mit.edu/~gsstark/resume.pdf