Automatic null values convertion in INSERT and WHERE statements

Поиск
Список
Период
Сортировка
От Tomasz Spyrczak
Тема Automatic null values convertion in INSERT and WHERE statements
Дата
Msg-id INEGJMKOLIHIBIAKIOLCEECGCCAA.cbsman@gnuos.net
обсуждение исходный текст
Ответы Re: Automatic null values convertion in INSERT and WHERE statements
Re: Automatic null values convertion in INSERT and WHERE
Список pgsql-admin
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi there!

I've just compiled PostgreSQL 7.4 and come across this problem:

I have a table like this:

CREATE TABLE test (field1 integer, field2 integer default 0);

Then I want to insert some "empty" record like this:

INSERT INTO test (field1, field2) VALUES ('', '');

My question is: how to "convince" PostgreSQL to automatically convert (as it
is mentioned in the documentation) the given empty values to the default
values of field1 (to insert null value) and field2 (to insert default value
of 0)? After default compilation PostgreSQL 7.4 gives an error while doing
an insert query like this.

Currently I am using pre-compiled PostgreSQL 7.2 from Linux Mandrake 9 and
such an insert query described above works as desired - it inserts into a
table default or null values without an error.

How can I make PostgreSQL 7.4 to behave like that?

Similarily I want PostgreSQL to accept and automatically convert to "IS
NULL" "where" statements like this:

SELECT * FROM test WHERE field1='';

I suppose this behavior can be change at the compile-time, but how please
tell me :-(

Best regards
Tomasz Spyrczak

cbsman-at-gnuos.net

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQA/AwUBP7s/LMbMsgKq/FYXEQKQwgCg3G6zzpBBAy+g2Rq5M9s6NeCQm68An3PG
GJe5jmiOhK+eWRD6hOAshj0o
=dOmw
-----END PGP SIGNATURE-----


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

Предыдущее
От: Lucio
Дата:
Сообщение: Postgresql DB on a live cd
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: Automatic null values convertion in INSERT and WHERE statements