From: Scott Marlowe <smarlowe@g2switchworks.com>
To: David.Bear@asu.edu
Cc: pgsql-admin@postgresql.org
Subject: Re: syntax issue with insert statement
Date: Thu, 13 Jan 2005 12:45:39 -0600
Message-ID: <1105641939.24795.93.camel@state.g2switchworks.com> (raw)
In-Reply-To: <20050113171747.7A314FB3@moroni.pp.asu.edu>
References: <20050113171747.7A314FB3@moroni.pp.asu.edu>
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');
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: smarlowe@g2switchworks.com, David.Bear@asu.edu
Subject: Re: syntax issue with insert statement
In-Reply-To: <1105641939.24795.93.camel@state.g2switchworks.com>
References: <20050113171747.7A314FB3@moroni.pp.asu.edu> <1105641939.24795.93.camel@state.g2switchworks.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox