X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 73981D1D708 for ; Wed, 19 Nov 2003 10:01:51 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 42041-03 for ; Wed, 19 Nov 2003 06:01:21 -0400 (AST) Received: from gnu.univ.gda.pl (gnu.univ.gda.pl [153.19.120.250]) by svr1.postgresql.org (Postfix) with ESMTP id BCCDDD1D760 for ; Wed, 19 Nov 2003 06:01:02 -0400 (AST) Received: from rg114.internetdsl.tpnet.pl ([80.55.58.114] helo=go1) by gnu.univ.gda.pl with smtp (Exim 3.36 #2 (Debian)) id 1AMP8r-00015z-00 for ; Wed, 19 Nov 2003 11:00:57 +0100 Reply-To: From: "Tomasz Spyrczak" To: Subject: Automatic null values convertion in INSERT and WHERE statements Date: Wed, 19 Nov 2003 11:00:25 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Importance: Normal X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/358 X-Sequence-Number: 11345 -----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-----