Hello

this patch add anyelement variants of functions quote_literal and
quote_ident. Changes of casting rules in 8.3 has impact on these
functions, but there is same situation like operator ||. Is clear so
arguments is string or have to cast to string.

Regards
Pavel Stehule
*** ./src/include/catalog/pg_proc.h.orig	2007-11-25 17:33:44.000000000 +0100
--- ./src/include/catalog/pg_proc.h	2007-11-25 17:44:17.000000000 +0100
***************
*** 2631,2636 ****
--- 2631,2641 ----
  DESCR("quote an identifier for usage in a querystring");
  DATA(insert OID =  1283 ( quote_literal    PGNSP PGUID 12 1 0 f f t f i 1 25 "25" _null_ _null_ _null_ quote_literal - _null_ _null_ ));
  DESCR("quote a literal for usage in a querystring");
+ DATA(insert OID =  1191 ( quote_ident	   PGNSP PGUID 14 1 0 f f t f i 1 25 "2283" _null_ _null_ _null_ "select quote_ident($1::text)" - _null_ _null_ ));
+ DESCR("quote an identifier for usage in a querystring");
+ DATA(insert OID =  1192 ( quote_literal    PGNSP PGUID 14 1 0 f f t f i 1 25 "2283" _null_ _null_ _null_ "select quote_literal($1::text)" - _null_ _null_ ));
+ DESCR("quote a literal for usage in a querystring");
+ 
  
  DATA(insert OID = 1798 (  oidin			   PGNSP PGUID 12 1 0 f f t f i 1 26 "2275" _null_ _null_ _null_ oidin - _null_ _null_ ));
  DESCR("I/O");
*** ./src/test/regress/expected/strings.out.orig	2007-11-25 18:01:26.000000000 +0100
--- ./src/test/regress/expected/strings.out	2007-11-25 17:57:58.000000000 +0100
***************
*** 1240,1242 ****
--- 1240,1269 ----
   a\bcd | a\b'cd | a\b''cd | abcd\ | ab\'cd | \\
  (1 row)
  
+ --
+ -- test quote_literal and quote_ident functions
+ --
+ select quote_literal('message');
+  quote_literal 
+ ---------------
+  'message'
+ (1 row)
+ 
+ select quote_literal(10);
+  quote_literal 
+ ---------------
+  '10'
+ (1 row)
+ 
+ select quote_ident('message');
+  quote_ident 
+ -------------
+  message
+ (1 row)
+ 
+ select quote_ident(10);
+  quote_ident 
+ -------------
+  "10"
+ (1 row)
+ 
*** ./src/test/regress/sql/strings.sql.orig	2007-11-25 17:56:45.000000000 +0100
--- ./src/test/regress/sql/strings.sql	2007-11-25 18:05:32.000000000 +0100
***************
*** 450,452 ****
--- 450,460 ----
  set standard_conforming_strings = off;
  
  select 'a\\bcd' as f1, 'a\\b\'cd' as f2, 'a\\b\'''cd' as f3, 'abcd\\'   as f4, 'ab\\\'cd' as f5, '\\\\' as f6;
+ 
+ --
+ -- test quote_literal and quote_ident functions
+ --
+ select quote_literal('message');
+ select quote_literal(10);
+ select quote_ident('message');
+ select quote_ident(10);
---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to