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 767693A5A5E for ; Thu, 13 Jan 2005 18:45:45 +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 85195-05 for ; Thu, 13 Jan 2005 18:45:40 +0000 (GMT) Received: from koolancexeon.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by svr1.postgresql.org (Postfix) with ESMTP id 4B5343A5A2C for ; Thu, 13 Jan 2005 18:45:40 +0000 (GMT) Received: mail.g2switchworks.com 10.10.1.8 from 10.10.1.37 10.10.1.37 via HTTP with MS-WebStorage 6.5.6944 Received: from state.g2switchworks.com by mail.g2switchworks.com; 13 Jan 2005 12:45:39 -0600 Subject: Re: syntax issue with insert statement From: Scott Marlowe To: David.Bear@asu.edu Cc: pgsql-admin@postgresql.org In-Reply-To: <20050113171747.7A314FB3@moroni.pp.asu.edu> References: <20050113171747.7A314FB3@moroni.pp.asu.edu> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1105641939.24795.93.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Thu, 13 Jan 2005 12:45:39 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200501/124 X-Sequence-Number: 15983 On Thu, 2005-01-13 at 11:17, 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. 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 > > > I could not get the INSERT statement to work using the column name VALUES > syntax. > > So, then I tried: > > docflow=> INSERT INTO student VALUES (29394959, David, Doe, _, 09/09/99, '{test}') > > That worked. > > I though I might have quoting issue, but I'm sticking with lower case > identifiers. > > This seems like such a trivial question, but I just cant see where I went > wrong. Maybe I've stared at it too long. Please advise. Text strings and dates need to be surrounded by single quotes, so your 1st insert should look like: INSERT INTO student (first_name, last_name, middle_name, added_by, affiliate_id, added_on) VALUES ('John', 'Doe', '-', '{john}', 484848484, '02/02/20');