Created
June 24, 2015 00:56
-
-
Save matchy256/36044648d33b72e92141 to your computer and use it in GitHub Desktop.
古いPostgreSQLから移設したデータベースでキャストエラーが出るとき
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- for PostgreSQL 8.2 | |
CREATE FUNCTION int4text(int4) RETURNS text AS 'SELECT textin(int4out($1))' LANGUAGE sql IMMUTABLE STRICT; | |
CREATE CAST (int4 AS text) WITH FUNCTION int4text(int4) AS IMPLICIT; | |
CREATE FUNCTION int8text(int8) RETURNS text AS 'SELECT textin(int8out($1))' LANGUAGE sql IMMUTABLE STRICT; | |
CREATE CAST (int8 AS text) WITH FUNCTION int8text(int8) AS IMPLICIT; | |
-- for PostgreSQL 8.4 or later | |
CREATE CAST (int4 AS text) WITH INOUT AS IMPLICIT; | |
CREATE CAST (int8 AS text) WITH INOUT AS IMPLICIT; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment