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 8CD473A5277 for ; Thu, 13 Jan 2005 18:51:32 +0000 (GMT) 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 86269-03 for ; Thu, 13 Jan 2005 18:51:23 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 0EF0E3A58AC for ; Thu, 13 Jan 2005 18:51:23 +0000 (GMT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.1/8.13.1) with ESMTP id j0DIp8Lw053223 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 13 Jan 2005 11:51:11 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.1/8.13.1) with ESMTP id j0DIp8op031824; Thu, 13 Jan 2005 11:51:08 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.1/8.13.1/Submit) id j0DIp8il031823; Thu, 13 Jan 2005 11:51:08 -0700 (MST) (envelope-from mfuhr) Date: Thu, 13 Jan 2005 11:51:08 -0700 From: Michael Fuhr To: David Bear Cc: pgsql-admin@postgresql.org Subject: Re: syntax issue with insert statement Message-ID: <20050113185108.GA31737@winnie.fuhr.org> References: <20050113171747.7A314FB3@moroni.pp.asu.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050113171747.7A314FB3@moroni.pp.asu.edu> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/123 X-Sequence-Number: 15982 On Thu, Jan 13, 2005 at 10:17:47AM -0700, David Bear wrote: > I'm in process of migrating data. That means lots of data munging. > > I decided that while I'm coding I should go ahead and create sql syntax rather > than just some delimited file. If you have a lot of data to load, then using COPY with a delimited file will be faster than a series of INSERTs. > So I produced the following code: > > docflow=> INSERT INTO student (first_name, last_name, middle_name, added_by, > affiliate_id, added_on) VALUES (John, Doe, -, '{john}', 484848484, 02/02/20); > > ERROR: syntax error at or near "," at character 112 You should be quoting the non-numeric values: INSERT INTO student (first_name, last_name, middle_name, added_by, affiliate_id, added_on) VALUES ('John', 'Doe', '-', '{john}', 484848484, '02/02/20'); > So, then I tried: > > docflow=> INSERT INTO student VALUES (29394959, David, Doe, _, 09/09/99, '{test}') > > That worked. That's surprising -- what version of PostgreSQL are you using? Is something preprocessing your statements before sending them to the backend? The non-numeric values should be quoted; failure to do so should result in errors like 'column "david" does not exist'. -- Michael Fuhr http://www.fuhr.org/~mfuhr/