Thread: escape character in a function

escape character in a function

From
"Patrick Hatcher"
Date:
Howdy
How do I do an escape character in a function to for a word that has an
apostrophe like: RICH'S.  I tried ''RICH\'S'', but when I run my function,
I get back mismatch parentheses.
TIA

REATE FUNCTION "sp_updaterlg"() RETURNS "int4" AS '
begin
  update bcp_cust
  set div_name = ''RICH\'S''
   where
   div_store is not null
   and instr(div_store,''RICH\'S'',1) >0;

  return 1;
end;
' LANGUAGE 'plpgsql';

Patrick Hatcher
Macys.Com



Re: escape character in a function

From
"Henshall, Stuart - WCP"
Date:
Try doubleing the apostraphe again, ie:
 set div_name = ''RICH''''S''
Cheers,
- Stuart

> -----Original Message-----
> From: Patrick Hatcher [mailto:PHatcher@macys.com]
> Sent: 23 April 2002 22:26
> To: pgsql-novice@postgresql.org
> Subject: [NOVICE] escape character in a function
>
>
> Howdy
> How do I do an escape character in a function to for a word
> that has an
> apostrophe like: RICH'S.  I tried ''RICH\'S'', but when I run
> my function,
> I get back mismatch parentheses.
> TIA
>
> REATE FUNCTION "sp_updaterlg"() RETURNS "int4" AS '
> begin
>   update bcp_cust
>   set div_name = ''RICH\'S''
>    where
>    div_store is not null
>    and instr(div_store,''RICH\'S'',1) >0;
>
>   return 1;
> end;
> ' LANGUAGE 'plpgsql';
>
> Patrick Hatcher
> Macys.Com
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

pg_setlocale()

From
Torbjörn Andersson
Date:
Hi,

I get the following error message intermittently:

NOTICE:  pg_setlocale(): 'LC_COLLATE=(t08@' cannot be honored.
NOTICE:  pg_setlocale(): 'LC_CTYPE=08@' cannot be honored.

I think that it may be connected to a problem where 'WAS' = 'WAS' sometimes
isn't true but 'WAS' ILIKE 'WAS' is always true.

Is there any chance that the error will "go away" if I dump the database and
run initdb again?

                            version
---------------------------------------------------------------
 PostgreSQL 7.1.3 on i686-pc-linux-gnu, compiled by GCC 2.95.2
(1 row)



Regards

Torbjörn Andersson
---------------------------------------------------
Embryo Communication      phone: +46 (0) 31-774 39 11(00)
Kungsgatan 7a             fax: +46 (0)31 774 07 80
S-411 19 Göteborg         mobile: 0708-30 70 04
Sweden                    home: http://www.embryo.se/
        mail: torbjorn.andersson@embryo.se
---------------------------------------------------




Re: pg_setlocale()

From
Tom Lane
Date:
Torbj=?ISO-8859-1?B?9g==?=rn Andersson <tobbe@embryo.se> writes:
> I get the following error message intermittently:

> NOTICE:  pg_setlocale(): 'LC_COLLATE=(t08@' cannot be honored.
> NOTICE:  pg_setlocale(): 'LC_CTYPE=08@' cannot be honored.

Update to 7.2.  This is a bug that appears on some platforms but not
others, and wasn't noticed until after 7.1 was released.

            regards, tom lane

Re: escape character in a function

From
"Patrick Hatcher"
Date:
That did it.  Thank you.

Patrick Hatcher
Macys.Com