A minor patch to mark xml/xslt functions immutable - Mailing list pgsql-patches

From Ilia Kantor
Subject A minor patch to mark xml/xslt functions immutable
Date
Msg-id auto-000208451197@frontend1.aha.ru
Whole thread Raw
Responses Re: A minor patch to mark xml/xslt functions immutable
List pgsql-patches
Immutability is obvious, because xml procession result depends on the
document and request solely.

Couldn't use it for indexes w/o that flag.



--- /root/pgxml.sql.in    Sat Jul  9 21:41:33 2005
+++
/usr/ports/databases/postgresql-contrib/work/postgresql-8.0.3/contrib/xml2/p
gxml.sql.in    Sat Jul  9 21:41:36 2005
@@ -1,31 +1,31 @@
 --SQL for XML parser

-CREATE OR REPLACE FUNCTION xml_valid(text) RETURNS bool
+CREATE OR REPLACE FUNCTION xml_valid(text) RETURNS bool IMMUTABLE
     AS 'MODULE_PATHNAME' LANGUAGE 'c' WITH (isStrict);

-CREATE OR REPLACE FUNCTION xml_encode_special_chars(text) RETURNS text
+CREATE OR REPLACE FUNCTION xml_encode_special_chars(text) RETURNS text
IMMUTABLE
     AS 'MODULE_PATHNAME' LANGUAGE 'c' WITH (isStrict);

-CREATE OR REPLACE FUNCTION xpath_string(text,text) RETURNS text
+CREATE OR REPLACE FUNCTION xpath_string(text,text) RETURNS text IMMUTABLE
     AS 'MODULE_PATHNAME' LANGUAGE 'c' WITH (isStrict);

-CREATE OR REPLACE FUNCTION xpath_nodeset(text,text,text,text) RETURNS text
+CREATE OR REPLACE FUNCTION xpath_nodeset(text,text,text,text) RETURNS text
IMMUTABLE
     AS 'MODULE_PATHNAME' LANGUAGE 'c' WITH (isStrict);

-CREATE OR REPLACE FUNCTION xpath_number(text,text) RETURNS float4
+CREATE OR REPLACE FUNCTION xpath_number(text,text) RETURNS float4 IMMUTABLE
     AS 'MODULE_PATHNAME' LANGUAGE 'c' WITH (isStrict);

-CREATE OR REPLACE FUNCTION xpath_bool(text,text) RETURNS boolean
+CREATE OR REPLACE FUNCTION xpath_bool(text,text) RETURNS boolean IMMUTABLE
     AS 'MODULE_PATHNAME' LANGUAGE 'c' WITH (isStrict);

 -- List function

-CREATE OR REPLACE FUNCTION xpath_list(text,text,text) RETURNS text
+CREATE OR REPLACE FUNCTION xpath_list(text,text,text) RETURNS text
IMMUTABLE
     AS 'MODULE_PATHNAME'
     LANGUAGE 'c' WITH (isStrict);


-CREATE OR REPLACE FUNCTION xpath_list(text,text) RETURNS text
+CREATE OR REPLACE FUNCTION xpath_list(text,text) RETURNS text IMMUTABLE
 AS 'SELECT xpath_list($1,$2,'','')' language 'SQL' WITH (isStrict);


@@ -33,16 +33,16 @@
 -- Wrapper functions for nodeset where no tags needed.


-CREATE OR REPLACE FUNCTION xpath_nodeset(text,text) RETURNS text AS
+CREATE OR REPLACE FUNCTION xpath_nodeset(text,text) RETURNS text IMMUTABLE
AS
 'SELECT xpath_nodeset($1,$2,'''','''')' language 'SQL' WITH (isStrict);


-CREATE OR REPLACE FUNCTION xpath_nodeset(text,text,text) RETURNS text AS
+CREATE OR REPLACE FUNCTION xpath_nodeset(text,text,text) RETURNS text
IMMUTABLE AS
 'SELECT xpath_nodeset($1,$2,'''',$3)' language 'SQL' WITH (isStrict);

 -- Table function

-CREATE OR REPLACE FUNCTION xpath_table(text,text,text,text,text) RETURNS
setof record
+CREATE OR REPLACE FUNCTION xpath_table(text,text,text,text,text) RETURNS
setof record IMMUTABLE
     AS 'MODULE_PATHNAME'
     LANGUAGE 'c' WITH (isStrict);

@@ -51,10 +51,10 @@
 -- XSLT support.


-CREATE OR REPLACE FUNCTION xslt_process(text,text,text) RETURNS text
+CREATE OR REPLACE FUNCTION xslt_process(text,text,text) RETURNS text
IMMUTABLE
     AS 'MODULE_PATHNAME' LANGUAGE 'c' WITH (isStrict);

 -- the function checks for the correct argument count

-CREATE OR REPLACE FUNCTION xslt_process(text,text) RETURNS text
+CREATE OR REPLACE FUNCTION xslt_process(text,text) RETURNS text IMMUTABLE
     AS 'MODULE_PATHNAME' LANGUAGE 'c' WITH (isStrict);


pgsql-patches by date:

Previous
From: Titus von Boxberg
Date:
Subject: PL/PGSQL: Dynamic Record Introspection
Next
From: Neil Conway
Date:
Subject: Re: PL/PGSQL: Dynamic Record Introspection