X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 36398D1B1B3 for ; Fri, 9 Jul 2004 05:38:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60954-04 for ; Fri, 9 Jul 2004 08:38:12 +0000 (GMT) Received: from lorraine.ipl.co.uk (lorraine.ipl.co.uk [195.112.52.123]) by svr1.postgresql.org (Postfix) with ESMTP id B95ECD1B173 for ; Fri, 9 Jul 2004 05:38:08 -0300 (ADT) Received: from HFPORT.dmr.co.uk (pennsoft.gotadsl.co.uk [81.6.232.68]) by lorraine.ipl.co.uk (8.12.9/8.12.9) with ESMTP id i698bxMT032376; Fri, 9 Jul 2004 09:38:02 +0100 Message-Id: <5.1.0.14.0.20040709093611.05621ea0@mailserver.dmr.co.uk> X-Sender: hf1@mailserver.dmr.co.uk X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Fri, 09 Jul 2004 09:40:01 +0100 To: Stef , pgsql-admin@postgresql.org From: Hilary Forbes Subject: Re: Bad dumps... In-Reply-To: <20040709095738.5738334f@svb.ucs.co.za> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/114 X-Sequence-Number: 14182 This is very similar to my problem with the ascii code 13s when I dumped and couldn't load the dumped data. What I did was to write a short script replaced the offending characters with an empty string which is different to NULL. The other alternative is to have myfield text DEFAULT '' NOT NULL in your schema. (The '' bit is two single quotes ie the empty string) This means anyone failing to insert a value for this column will cause the db to insert an empty string rather than leaving it as NULL.) Hilary At 09:57 09/07/2004 +0200, Stef wrote: >Hi all, > >I'm stuck with a problem,about which I couldn't find >much info. I'm sure somebody must have encountered this before. > >I've got a "NOT NULL" column of type text. >It happens that freehand data gets inserted into this table, and >it typically contains over 1000 rows with the value '\N' , and >about another 3400 rows that has an occurrence of '\N' > >The database dumps fine, but when I import it again, I get >"cannot insert null value into not null column"-type errors, >and if I don't pay close attention, I end up with an empty table >on the database. There is no way for me to tell how many columns >could be affected in future, but I need to stabilize the backups. > >I'm using postgres version 7.3.4 > >Any idea how to get around this problem? > >Kind Regards >Stefan Hilary Forbes The DMR Information and Technology Group (www.dmr.co.uk) Direct tel 01689 889950 Fax 01689 860330 DMR is a UK registered trade mark of DMR Limited **********************************************************