Re: mssql migration and boolean to integer problems - Mailing list pgsql-general

From Gregory Stark
Subject Re: mssql migration and boolean to integer problems
Date
Msg-id 87y7bx2mli.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: mssql migration and boolean to integer problems  (robert <robertlazarski@gmail.com>)
Responses Re: mssql migration and boolean to integer problems
List pgsql-general
"robert" <robertlazarski@gmail.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!

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: postgres writer process growing up too much
Next
From: Gregory Stark
Date:
Subject: Re: size cost for null fields