A minor patch to mark xml/xslt functions immutable

From: "Ilia Kantor" <ilia(at)obnovlenie(dot)ru>
To: <pgsql-patches(at)postgresql(dot)org>
Subject: A minor patch to mark xml/xslt functions immutable
Date: 2005-07-09 18:02:24
Message-ID: auto-000208451197@frontend1.aha.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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);

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-07-10 03:46:37 Re: thousands comma numeric formatting in psql
Previous Message Stephan Szabo 2005-07-09 17:09:15 Re: patch: garbage error strings in libpq