summaryrefslogtreecommitdiff
path: root/contrib/string/string_io.sql.in
diff options
context:
space:
mode:
authorBruce Momjian1997-11-05 21:38:25 +0000
committerBruce Momjian1997-11-05 21:38:25 +0000
commit951986c550dccfdafffcf2eda30980c7310b41b4 (patch)
tree9bd4eb75a2c8cdc96e72cd5675c0a398d9c3659c /contrib/string/string_io.sql.in
parent5aaf00f3f39848eb8fef768e3ec8c0e816a87172 (diff)
Update of contrib stuff from massimo.
Diffstat (limited to 'contrib/string/string_io.sql.in')
-rw-r--r--contrib/string/string_io.sql.in104
1 files changed, 104 insertions, 0 deletions
diff --git a/contrib/string/string_io.sql.in b/contrib/string/string_io.sql.in
new file mode 100644
index 00000000000..ad1a51607cd
--- /dev/null
+++ b/contrib/string/string_io.sql.in
@@ -0,0 +1,104 @@
+-- SQL code to define the new string I/O functions
+
+-- This is not needed because escapes are handled by the parser
+--
+-- create function c_textin(opaque)
+-- returns text
+-- as 'MODULE_PATHNAME'
+-- language 'c';
+
+create function c_charout(opaque) returns int4
+ as 'MODULE_PATHNAME'
+ language 'c';
+
+create function c_char2out(opaque) returns int4
+ as 'MODULE_PATHNAME'
+ language 'c';
+
+create function c_char4out(opaque) returns int4
+ as 'MODULE_PATHNAME'
+ language 'c';
+
+create function c_char8out(opaque) returns int4
+ as 'MODULE_PATHNAME'
+ language 'c';
+
+create function c_char16out(opaque) returns int4
+ as 'MODULE_PATHNAME'
+ language 'c';
+
+create function c_textout(opaque) returns int4
+ as 'MODULE_PATHNAME'
+ language 'c';
+
+create function c_varcharout(opaque) returns int4
+ as 'MODULE_PATHNAME'
+ language 'c';
+
+
+-- Define a function which sets the new output routines for char types
+--
+-- select c_mode();
+--
+create function c_mode() returns text
+ as 'update pg_type set typoutput=''c_charout'' where typname=''char'';
+ update pg_type set typoutput=''c_char2out'' where typname=''char2'';
+ update pg_type set typoutput=''c_char4out'' where typname=''char4'';
+ update pg_type set typoutput=''c_char8out'' where typname=''char8'';
+ update pg_type set typoutput=''c_char16out'' where typname=''char16'';
+ update pg_type set typoutput=''c_textout'' where typname=''text'';
+ update pg_type set typoutput=''c_textout'' where typname=''bytea'';
+ update pg_type set typoutput=''c_textout'' where typname=''unknown'';
+ update pg_type set typoutput=''c_textout'' where typname=''SET'';
+ update pg_type set typoutput=''c_varcharout'' where typname=''varchar'';
+ update pg_type set typoutput=''c_varcharout'' where typname=''bpchar'';
+ select ''c_mode''::text'
+ language 'sql';
+
+-- Define a function which restores the original routines for char types
+--
+-- select pg_mode();
+--
+create function pg_mode() returns text
+ as 'update pg_type set typoutput=''charout'' where typname=''char'';
+ update pg_type set typoutput=''char2out'' where typname=''char2'';
+ update pg_type set typoutput=''char4out'' where typname=''char4'';
+ update pg_type set typoutput=''char8out'' where typname=''char8'';
+ update pg_type set typoutput=''char16out'' where typname=''char16'';
+ update pg_type set typoutput=''textout'' where typname=''text'';
+ update pg_type set typoutput=''textout'' where typname=''bytea'';
+ update pg_type set typoutput=''textout'' where typname=''unknown'';
+ update pg_type set typoutput=''textout'' where typname=''SET'';
+ update pg_type set typoutput=''varcharout'' where typname=''varchar'';
+ update pg_type set typoutput=''varcharout'' where typname=''bpchar'';
+ select ''pg_mode''::text'
+ language 'sql';
+
+
+-- Use these if you want do the updates manually
+--
+-- update pg_type set typoutput='charout' where typname='char';
+-- update pg_type set typoutput='char2out' where typname='char2';
+-- update pg_type set typoutput='char4out' where typname='char4';
+-- update pg_type set typoutput='char8out' where typname='char8';
+-- update pg_type set typoutput='char16out' where typname='char16';
+-- update pg_type set typoutput='textout' where typname='text';
+-- update pg_type set typoutput='textout' where typname='bytea';
+-- update pg_type set typoutput='textout' where typname='unknown';
+-- update pg_type set typoutput='textout' where typname='SET';
+-- update pg_type set typoutput='varcharout' where typname='varchar';
+-- update pg_type set typoutput='varcharout' where typname='bpchar';
+--
+-- update pg_type set typoutput='c_charout' where typname='char';
+-- update pg_type set typoutput='c_char2out' where typname='char2';
+-- update pg_type set typoutput='c_char4out' where typname='char4';
+-- update pg_type set typoutput='c_char8out' where typname='char8';
+-- update pg_type set typoutput='c_char16out' where typname='char16';
+-- update pg_type set typoutput='c_textout' where typname='text';
+-- update pg_type set typoutput='c_textout' where typname='bytea';
+-- update pg_type set typoutput='c_textout' where typname='unknown';
+-- update pg_type set typoutput='c_textout' where typname='SET';
+-- update pg_type set typoutput='c_varcharout' where typname='varchar';
+-- update pg_type set typoutput='c_varcharout' where typname='bpchar';
+
+-- end of file