Skip to content

Instantly share code, notes, and snippets.

@EvanCarroll
Created May 10, 2012 23:25
Show Gist options
  • Save EvanCarroll/2656537 to your computer and use it in GitHub Desktop.
Save EvanCarroll/2656537 to your computer and use it in GitHub Desktop.
Postgresql bug.
CREATE TYPE citext;
--
-- Name: citextin(cstring); Type: FUNCTION; Schema: public; Owner: ecarroll
--
CREATE FUNCTION citextin(cstring) RETURNS citext
LANGUAGE internal IMMUTABLE STRICT
AS $$textin$$;
ALTER FUNCTION public.citextin(cstring) OWNER TO ecarroll;
--
-- Name: citextout(citext); Type: FUNCTION; Schema: public; Owner: ecarroll
--
CREATE FUNCTION citextout(citext) RETURNS cstring
LANGUAGE internal IMMUTABLE STRICT
AS $$textout$$;
ALTER FUNCTION public.citextout(citext) OWNER TO ecarroll;
--
-- Name: citextrecv(internal); Type: FUNCTION; Schema: public; Owner: ecarroll
--
CREATE FUNCTION citextrecv(internal) RETURNS citext
LANGUAGE internal STABLE STRICT
AS $$textrecv$$;
ALTER FUNCTION public.citextrecv(internal) OWNER TO ecarroll;
--
-- Name: citextsend(citext); Type: FUNCTION; Schema: public; Owner: ecarroll
--
CREATE FUNCTION citextsend(citext) RETURNS bytea
LANGUAGE internal STABLE STRICT
AS $$textsend$$;
ALTER FUNCTION public.citextsend(citext) OWNER TO ecarroll;
--
-- Name: citext; Type: TYPE; Schema: public; Owner: ecarroll
--
CREATE TYPE citext (
INTERNALLENGTH = variable,
INPUT = citextin,
OUTPUT = citextout,
RECEIVE = citextrecv,
SEND = citextsend,
CATEGORY = 'S',
ALIGNMENT = int4,
STORAGE = extended
);
ALTER TYPE public.citext OWNER TO ecarroll;
\echo CREATING DOMAIN footype
CREATE DOMAIN footype AS citext;
\echo [1a] CREATING TABLE tablefoo_before (contains columns bar, type footype)
CREATE TABLE tablefoo_before ( bar footype );
\echo [1b] CREATING TEMP TABLE trash AS SELECT * FROM tablefoo_before
CREATE TEMP TABLE trash AS SELECT * FROM tablefoo_before ;
\echo RUNING PATCH TO UPDATE citext
UPDATE pg_catalog.pg_type SET typcollation = 100
WHERE oid = 'citext'::pg_catalog.regtype;
UPDATE pg_catalog.pg_attribute SET attcollation = 100
WHERE atttypid = 'citext'::pg_catalog.regtype;
\echo [2a] CREATING TABLE tablefoo_after (contains columns bar, type footype)
CREATE TABLE tablefoo_after ( bar footype );
\echo [2b] CREATING TEMP TABLE trash2 AS SELECT * FROM tablefoo_before
CREATE TEMP TABLE trash2 AS SELECT * FROM tablefoo_before ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment