Re: quote_literal() fails with unmatched quotes

From: "James M Doherty" <jim(at)jdoherty(dot)net>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: quote_literal() fails with unmatched quotes
Date: 2005-11-30 21:22:25
Message-ID: !~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAGKgFc6RcN0+tZU9CuUmdQ8KAAAAQAAAAj3oK7FVNxUSFJ6EtYvT8yAEAAAAA@jdoherty.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Nmostlikemat := ''10/3/2009'';

What happens is that quote_literal works for everyone in the example but
this one.

Jim

James M Doherty
Principal

JMD CONSULTING
411 Thunderbay Dr
Georgetown, TX 78626
A reputation is something others give you HONOR is something you give
yourself!

-----Original Message-----
From: pgsql-sql-owner(at)postgresql(dot)org [mailto:pgsql-sql-owner(at)postgresql(dot)org]
On Behalf Of James M Doherty
Sent: Wednesday, November 30, 2005 2:33 PM
To: pgsql-sql(at)postgresql(dot)org
Subject: [SQL] quote_literal() fails with unmatched quotes


I have had the following problem and been unable to determine the cause !

nmostlikemat := iso_date(nmostlikemat);
EXECUTE ''insert into scenario_inv (''
|| ''inv_id,''
|| ''record_date,''
|| ''scenario_type,''
|| ''mostlikemat,''
|| ''mktpr,''
|| ''mktyld )''
|| '' values ( ''
|| quote_literal(ID)
|| '',''
|| quote_literal(nnrecord_date)
|| '',''
|| quote_literal(nscid)
|| '',''
|| quote_literal(nmostlikemat)
|| '',''
|| quote_literal(nmktpr)
|| '',''
|| quote_literal(nmktyld)
|| '');'';


The following error returns from postgres 8.1

ERROR: unterminated quoted string at or near "'2009-10-03" at character 122
QUERY: insert into scenario_inv
(inv_id,record_date,scenario_type,mostlikemat,mktpr,mktyld ) values (
'405832','2005-06-30','1','2009-10-03
CONTEXT: PL/pgSQL function "scenario_set" line 502 at execute statement
PL/pgSQL function "fix_invest_set_scenario" line 18 at if
LINE 1: ...mktpr,mktyld ) values ( '405832','2005-06-30','1','2009-10-0...


James M Doherty
Principal

JMD CONSULTING
411 Thunderbay Dr
Georgetown, TX 78626
A reputation is something others give you HONOR is something you give
yourself!

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Scott Marlowe 2005-11-30 21:23:11 Re: child fk problem
Previous Message James M Doherty 2005-11-30 21:20:36 Quote_literal()