Re: Parser: parse error - please help...

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Andrew Ayers <aayers(at)eldocomp(dot)com>
Cc: PostgreSQL general list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Parser: parse error - please help...
Date: 2003-12-22 23:43:52
Message-ID: 20031222234351.GB2752@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron St-Pierre 2003-12-22 23:47:36 COPY - Ignore Problems
Previous Message Alvaro Herrera 2003-12-22 23:37:35 Re: restoring database