Re: Parser: parse error - please help... - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: Parser: parse error - please help...
Date
Msg-id 20031222234351.GB2752@dcc.uchile.cl
Whole thread Raw
In response to Parser: parse error - please help...  (Andrew Ayers <aayers@eldocomp.com>)
List pgsql-general
On Mon, Dec 22, 2003 at 04:24:52PM -0700, Andrew Ayers wrote:

> INSERT INTO reg("customer number", "company name", address, city, state,
> zip, phone, alt_phone, fax, alt_fax, iaccess, browser, provider,
> software, sversion, ynintegrated, ynnewtest, login, password, txtnetid,
> alias_1, alias_2, url, approval_password, ynauthalert, loi_date,
> contract_eff, contract_term, term_code, main_eff, main_term, live_eff,
> renewal_eff, cs_rep, txtactmanager, txtsalesrep, txtprojmanager,
> modem_number, dbc_users, intbillableusers, country, mmowarning,
> mmositefileflags, verified, buildtimedate, ynhipaaba) VALUES ('855',
> 'Test Company', '1234 West Jazz Street', 'Tempe', 'AZ', '85203', '(602)
> 123-4567', '(602) 123-4567', '(602) 123-4567', '(602) 123-4567', true,
> 'Internet Explorer', DEFAULT, 'HP3.5', '13', false, false, 'eci855',
> DEFAULT, DEFAULT, 'Test', 'Tester', 'http:\\www.eldocomp.com\', DEFAULT,

Note here:                                                    ^^

> false, DEFAULT, '09/11/2002', DEFAULT, DEFAULT, '09/11/2002', DEFAULT,
> DEFAULT, DEFAULT, 'Chris Riesgraf ext. 244', 'Keri Daminelli ext. 246',
> 'Kerry Winkle ext. 229', DEFAULT, DEFAULT, DEFAULT,
>   '0', 'USA', 'afdsf', DEFAULT, DEFAULT, DEFAULT, false);

You have an escaped ', which will make the string literal continue till
the next '.  You should really be escaping your \ and ' when they are
embedded in data.  Consider something like "Joh\n"; it will insert Joh
followed by a newline.

Also, an URL with \ is quite weird ... I think they like / best.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
You liked Linux a lot when he was just the gawky kid from down the block
mowing your lawn or shoveling the snow. But now that he wants to date
your daughter, you're not so sure he measures up. (Larry Greenemeier)

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: restoring database
Next
From: Ron St-Pierre
Date:
Subject: COPY - Ignore Problems