mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
b663f3443b
with OPAQUE, as per recent pghackers discussion. I still want to do some more work on the 'cstring' pseudo-type, but I'm going to commit the bulk of the changes now before the tree starts shifting under me ...
80 lines
3.2 KiB
MySQL
80 lines
3.2 KiB
MySQL
-- string_io.sql --
|
|
--
|
|
-- SQL code to define the new string I/O functions
|
|
--
|
|
-- 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.
|
|
|
|
-- Define the new output functions.
|
|
--
|
|
create function c_charout(bpchar) returns cstring
|
|
as 'MODULE_PATHNAME'
|
|
language 'c';
|
|
|
|
create function c_textout(text) returns cstring
|
|
as 'MODULE_PATHNAME'
|
|
language 'c';
|
|
|
|
create function c_varcharout(varchar) returns cstring
|
|
as 'MODULE_PATHNAME'
|
|
language 'c';
|
|
|
|
-- This is not needed because escapes are handled by the parser
|
|
--
|
|
-- create function c_textin(cstring)
|
|
-- returns text
|
|
-- 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_textout'' where typname=''SET'';
|
|
update pg_type set typoutput=''c_varcharout'' where typname=''bpchar'';
|
|
update pg_type set typoutput=''c_textout'' where typname=''bytea'';
|
|
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'';
|
|
select ''c_mode''::text;'
|
|
language 'sql';
|
|
|
|
-- Define a function which restores the standard routines for char types.
|
|
--
|
|
-- select pg_mode();
|
|
--
|
|
create function pg_mode() returns text
|
|
as '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'';
|
|
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'';
|
|
select ''pg_mode''::text;'
|
|
language 'sql';
|
|
|
|
-- Use these to do the changes manually.
|
|
--
|
|
-- 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';
|
|
-- 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';
|
|
--
|
|
-- 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';
|
|
-- 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
|