1998-08-31 03:37:51 +08:00
|
|
|
-- string_io.sql --
|
|
|
|
--
|
1997-11-06 05:38:25 +08:00
|
|
|
-- SQL code to define the new string I/O functions
|
|
|
|
--
|
1998-08-31 03:37:51 +08:00
|
|
|
-- Copyright (c) 1998, Massimo Dal Zotto <dz@cs.unitn.it>
|
|
|
|
--
|
|
|
|
-- This file is distributed under the GNU General Public License
|
|
|
|
-- either version 2, or (at your option) any later version.
|
1997-11-06 05:38:25 +08:00
|
|
|
|
1998-08-31 03:37:51 +08:00
|
|
|
-- Define the new output functions.
|
|
|
|
--
|
2002-08-22 08:01:51 +08:00
|
|
|
create function c_charout(bpchar) returns cstring
|
1997-11-06 05:38:25 +08:00
|
|
|
as 'MODULE_PATHNAME'
|
|
|
|
language 'c';
|
|
|
|
|
2002-08-22 08:01:51 +08:00
|
|
|
create function c_textout(text) returns cstring
|
1997-11-06 05:38:25 +08:00
|
|
|
as 'MODULE_PATHNAME'
|
|
|
|
language 'c';
|
|
|
|
|
2002-08-22 08:01:51 +08:00
|
|
|
create function c_varcharout(varchar) returns cstring
|
1997-11-06 05:38:25 +08:00
|
|
|
as 'MODULE_PATHNAME'
|
|
|
|
language 'c';
|
|
|
|
|
1998-08-31 03:37:51 +08:00
|
|
|
-- This is not needed because escapes are handled by the parser
|
|
|
|
--
|
2002-08-22 08:01:51 +08:00
|
|
|
-- create function c_textin(cstring)
|
1998-08-31 03:37:51 +08:00
|
|
|
-- returns text
|
|
|
|
-- as 'MODULE_PATHNAME'
|
|
|
|
-- language 'c';
|
1997-11-06 05:38:25 +08:00
|
|
|
|
1998-08-31 03:37:51 +08:00
|
|
|
-- Define a function which sets the new output routines for char types.
|
1997-11-06 05:38:25 +08:00
|
|
|
--
|
|
|
|
-- select c_mode();
|
|
|
|
--
|
|
|
|
create function c_mode() returns text
|
1998-08-31 03:37:51 +08:00
|
|
|
as 'update pg_type set typoutput=''c_textout'' where typname=''SET'';
|
|
|
|
update pg_type set typoutput=''c_varcharout'' where typname=''bpchar'';
|
1997-11-06 05:38:25 +08:00
|
|
|
update pg_type set typoutput=''c_textout'' where typname=''bytea'';
|
1998-08-31 03:37:51 +08:00
|
|
|
update pg_type set typoutput=''c_charout'' where typname=''char'';
|
|
|
|
update pg_type set typoutput=''c_textout'' where typname=''text'';
|
1997-11-06 05:38:25 +08:00
|
|
|
update pg_type set typoutput=''c_textout'' where typname=''unknown'';
|
|
|
|
update pg_type set typoutput=''c_varcharout'' where typname=''varchar'';
|
1999-06-06 03:09:48 +08:00
|
|
|
select ''c_mode''::text;'
|
1997-11-06 05:38:25 +08:00
|
|
|
language 'sql';
|
|
|
|
|
1998-08-31 03:37:51 +08:00
|
|
|
-- Define a function which restores the standard routines for char types.
|
1997-11-06 05:38:25 +08:00
|
|
|
--
|
|
|
|
-- select pg_mode();
|
|
|
|
--
|
|
|
|
create function pg_mode() returns text
|
1998-08-31 03:37:51 +08:00
|
|
|
as 'update pg_type set typoutput=''textout'' where typname=''SET'';
|
|
|
|
update pg_type set typoutput=''varcharout'' where typname=''bpchar'';
|
1997-11-06 05:38:25 +08:00
|
|
|
update pg_type set typoutput=''textout'' where typname=''bytea'';
|
1998-08-31 03:37:51 +08:00
|
|
|
update pg_type set typoutput=''charout'' where typname=''char'';
|
|
|
|
update pg_type set typoutput=''textout'' where typname=''text'';
|
1997-11-06 05:38:25 +08:00
|
|
|
update pg_type set typoutput=''textout'' where typname=''unknown'';
|
|
|
|
update pg_type set typoutput=''varcharout'' where typname=''varchar'';
|
1999-06-06 03:09:48 +08:00
|
|
|
select ''pg_mode''::text;'
|
1997-11-06 05:38:25 +08:00
|
|
|
language 'sql';
|
|
|
|
|
1998-08-31 03:37:51 +08:00
|
|
|
-- Use these to do the changes manually.
|
1997-11-06 05:38:25 +08:00
|
|
|
--
|
1998-08-31 03:37:51 +08:00
|
|
|
-- update pg_type set typoutput='textout' where typname='SET';
|
|
|
|
-- update pg_type set typoutput='varcharout' where typname='bpchar';
|
|
|
|
-- update pg_type set typoutput='textout' where typname='bytea';
|
1997-11-06 05:38:25 +08:00
|
|
|
-- update pg_type set typoutput='charout' where typname='char';
|
|
|
|
-- update pg_type set typoutput='textout' where typname='text';
|
|
|
|
-- update pg_type set typoutput='textout' where typname='unknown';
|
|
|
|
-- update pg_type set typoutput='varcharout' where typname='varchar';
|
|
|
|
--
|
1998-08-31 03:37:51 +08:00
|
|
|
-- update pg_type set typoutput='c_textout' where typname='SET';
|
|
|
|
-- update pg_type set typoutput='c_varcharout' where typname='bpchar';
|
|
|
|
-- update pg_type set typoutput='c_textout' where typname='bytea';
|
1997-11-06 05:38:25 +08:00
|
|
|
-- update pg_type set typoutput='c_charout' where typname='char';
|
|
|
|
-- update pg_type set typoutput='c_textout' where typname='text';
|
|
|
|
-- update pg_type set typoutput='c_textout' where typname='unknown';
|
|
|
|
-- update pg_type set typoutput='c_varcharout' where typname='varchar';
|
|
|
|
|
|
|
|
-- end of file
|