Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f15Hv1x42606 for ; Mon, 5 Feb 2001 12:57:01 -0500 (EST) (envelope-from pgsql-sql-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f0VEU0q42009 for ; Wed, 31 Jan 2001 09:30:00 -0500 (EST) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.1/8.11.1) id f0VETcG11242 for pgsql-sql@postgresql.org; Wed, 31 Jan 2001 09:29:38 -0500 (EST) (envelope-from news) From: Ian Harding X-Newsgroups: comp.databases.postgresql.sql Subject: Re: no value for numeric filed in SQL statement causes an error Date: Wed, 31 Jan 2001 06:35:43 -0800 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 44 Message-ID: <3A7822BF.3E742BFB@pakrat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: scrappy@hub.org X-Mailer: Mozilla 4.61 [en] (X11; U; Linux 2.2.12-20 i686) X-Accept-Language: en To: pgsql-sql@postgresql.org X-Archive-Number: 200102/54 X-Sequence-Number: 1224 juerg.rietmann@pup.ch wrote: > Hi there > > I have a table with char and int fields. From my form I get no values back > for int fields when they are left blank. This causes the SQL insert to > fail. > > field type > name char > id int2 > city char > > insert into table (name,id,city) values ('roger rabbit',,'carrot city') > > The default for int/float fields is 0. Since I reuse the code of the > referring page I don't like to have all fields assigned 0 at the beginning. > > Who can help ??? > > Thanks ... jr > > ============================================ > PFISTER + PARTNER, SYSTEM - ENGINEERING AG > Juerg Rietmann > Grundstrasse 22a > 6343 Rotkreuz > Switzerland > > phone: +4141 790 4040 > fax: +4141 790 2545 > mobile: +4179 211 0315 > ============================================ That is by design, as they say. You can allow the default to take effect by changing your field list on the insert to not include id. insert into table (name,city) values ('roger rabbit','carrot city') I don't know what your front end is, but you could have it plug a figure into the offending fields if blank as well. Ian