Re: Problem inserting data

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Problem inserting data
Дата
Msg-id 200806200740.46335.aklaver@comcast.net
обсуждение исходный текст
Ответ на Problem inserting data  (Tk421 <vrobador@gmail.com>)
Ответы Re: Problem inserting data  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Problem inserting data  (Tk421 <vrobador@gmail.com>)
Список pgsql-sql
On Friday 20 June 2008 5:20 am, Tk421 wrote:
>    Hello everybody.
>
>     I''ve just converted an access database to postgres. The conversion
> was ok, but when i'm trying to insert data on some tables with boolean
> types from a Visual Basic application i receive an error. A sample:
>
>     table example, with firs field of integer, second of type text and
> third of type boolean
>
>     the query: INSERT INTO EXAMPLE VALUES (1, 'text', 0)
>
>     When i used access this worked fine, in boolean types 0 is false and
> 1 is true, but in postgres (8.1 and 8.3 version) i receive the next error:
>
>     column "premarco" is of type boolean but expression is of type integer
>
>     My question is, can i force postgres to accept integer values as
> boolean without changin query to INSERT INTO EXAMPLE VALUES (1, 'text',
> 0::boolean). This is a problem because if I have to do this i will have
> to test about one hundred queryes
>
>     Thank you very much

Two options:
1) Change the column in Postgres to an integer type.
2) Change the assignment in pg_cast from explicit  to implied for the 
int4,bool cast. See for more details:
http://www.postgresql.org/docs/8.3/interactive/catalog-pg-cast.html
-- 
Adrian Klaver
aklaver@comcast.net


В списке pgsql-sql по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: "TZ"/"tz" not supported
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Problem inserting data