Re: mssql migration and boolean to integer problems

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "robert" <robertlazarski(at)gmail(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: mssql migration and boolean to integer problems
Date: 2007-12-14 17:49:13
Message-ID: 87y7bx2mli.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


"robert" <robertlazarski(at)gmail(dot)com> writes:

> So it has two 'bool' - "includeScenario" and "deleted" . I have an
> insert like...
>
> INSERT INTO "ASSETSCENARIO"
> ("assetScenarioID",OBJ_VERSION,"includeScenario","scenarioName","probability","occurenceDate","notes","priceTarget","assetID","created","modified","createdUserID","modifiedUserID","deleted")
> VALUES
> (197,0,1,'2007-12-13 11:31:00.000','2007-12-13 11:31:00.000',2,2,NULL);

There's an SQL standard syntax too, but the Postgres-specific syntax is:

postgres=# select 1::bool;
bool
------
t
(1 row)

postgres=# select 0::bool;
bool
------
f
(1 row)

Alternatively you could just quote the inputs. If you insert '0' and '1'
they'll be parsed as boolean values. It's just because you used 0 and 1
without quotes that they're parsed as integers first then don't match the
boolean type.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's PostGIS support!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gregory Stark 2007-12-14 18:12:10 Re: size cost for null fields
Previous Message Richard Huxton 2007-12-14 17:48:27 Re: postgres writer process growing up too much