| From: | Michael Fuhr <mike(at)fuhr(dot)org> |
|---|---|
| To: | David Bear <David(dot)Bear(at)asu(dot)edu> |
| Cc: | pgsql-admin(at)postgresql(dot)org |
| Subject: | Re: syntax issue with insert statement |
| Date: | 2005-01-13 18:51:08 |
| Message-ID: | 20050113185108.GA31737@winnie.fuhr.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-admin |
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/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Goulet, Dick | 2005-01-13 18:52:41 | Re: Installing PostgreSQL as "postgress" versus "root" Debate! |
| Previous Message | Scott Marlowe | 2005-01-13 18:45:39 | Re: syntax issue with insert statement |