Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Include Peter Eisentraut's script to re-add implicit casts to Postgre…

…SQL 8.3,

as his Planet PostgreSQL blog is no longer available.
  • Loading branch information...
commit e9a477df5c0143255749d953ec1949a752813799 1 parent 263a48a
@jonjensen jonjensen authored
View
1  MANIFEST
@@ -1027,6 +1027,7 @@ eg/news_feature/products/news.txt
eg/news_feature/README
eg/news_feature/templates/components/news
eg/pcode
+eg/pg83-implicit-casts.sql
eg/reset_order_number
eg/survey_graph.tag
eg/survey_wizard/code/Widget/user_uploadhelper.widget
View
10 UPGRADE
@@ -81,13 +81,9 @@ relied on. By default, the Standard demo and some Interchange core SQL does
not work with PostgreSQL 8.3.
We expect to work around this in a future version of Interchange, but at the
-moment the easiest way to get things working is to manually put back the
-removed casts, as Peter Eisentraut describes here:
-
- http://people.planetpostgresql.org/peter/index.php?/archives/18-Readding-implicit-casts-in-PostgreSQL-8.3.html
-
-Running his pg83-implicit-casts.sql script fixes the known problems with the
-Standard demo.
+moment the easiest way to get things working is to manually put back any
+removed casts that you need. The included eg/pg83-implicit-casts.sql script
+fixes the known problems with the Standard demo.
This issue does not affect earlier versions of PostgreSQL.
View
2  WHATSNEW-5.6
@@ -8,7 +8,7 @@
See UPGRADE document for a list of incompatible changes.
-Interchange 5.6.1 released 2008-11-10.
+Interchange 5.6.1 released 2008-11-13.
Core
----
View
31 eg/pg83-implicit-casts.sql
@@ -0,0 +1,31 @@
+-- It is best to apply these as needed, rather than just throw them all in.
+-- The first one (int to text) solves 99% of 8.3 app compatibility problems
+
+-- by Peter Eisentraut, originally referenced at http://people.planetpostgresql.org/peter/index.php?/archives/18-Readding-implicit-casts-in-PostgreSQL-8.3.html
+
+CREATE FUNCTION pg_catalog.text(integer) RETURNS text STRICT IMMUTABLE LANGUAGE SQL AS 'SELECT textin(int4out($1));';
+CREATE CAST (integer AS text) WITH FUNCTION pg_catalog.text(integer) AS IMPLICIT;
+CREATE FUNCTION pg_catalog.text(smallint) RETURNS text STRICT IMMUTABLE LANGUAGE SQL AS 'SELECT textin(int2out($1));';
+CREATE CAST (smallint AS text) WITH FUNCTION pg_catalog.text(smallint) AS IMPLICIT;
+CREATE FUNCTION pg_catalog.text(oid) RETURNS text STRICT IMMUTABLE LANGUAGE SQL AS 'SELECT textin(oidout($1));';
+CREATE CAST (oid AS text) WITH FUNCTION pg_catalog.text(oid) AS IMPLICIT;
+CREATE FUNCTION pg_catalog.text(date) RETURNS text STRICT IMMUTABLE LANGUAGE SQL AS 'SELECT textin(date_out($1));';
+CREATE CAST (date AS text) WITH FUNCTION pg_catalog.text(date) AS IMPLICIT;
+CREATE FUNCTION pg_catalog.text(double precision) RETURNS text STRICT IMMUTABLE LANGUAGE SQL AS 'SELECT textin(float8out($1));';
+CREATE CAST (double precision AS text) WITH FUNCTION pg_catalog.text(double precision) AS IMPLICIT;
+CREATE FUNCTION pg_catalog.text(real) RETURNS text STRICT IMMUTABLE LANGUAGE SQL AS 'SELECT textin(float4out($1));';
+CREATE CAST (real AS text) WITH FUNCTION pg_catalog.text(real) AS IMPLICIT;
+CREATE FUNCTION pg_catalog.text(time with time zone) RETURNS text STRICT IMMUTABLE LANGUAGE SQL AS 'SELECT textin(timetz_out($1));';
+CREATE CAST (time with time zone AS text) WITH FUNCTION pg_catalog.text(time with time zone) AS IMPLICIT;
+CREATE FUNCTION pg_catalog.text(time without time zone) RETURNS text STRICT IMMUTABLE LANGUAGE SQL AS 'SELECT textin(time_out($1));';
+CREATE CAST (time without time zone AS text) WITH FUNCTION pg_catalog.text(time without time zone) AS IMPLICIT;
+CREATE FUNCTION pg_catalog.text(timestamp with time zone) RETURNS text STRICT IMMUTABLE LANGUAGE SQL AS 'SELECT textin(timestamptz_out($1));';
+CREATE CAST (timestamp with time zone AS text) WITH FUNCTION pg_catalog.text(timestamp with time zone) AS IMPLICIT;
+CREATE FUNCTION pg_catalog.text(interval) RETURNS text STRICT IMMUTABLE LANGUAGE SQL AS 'SELECT textin(interval_out($1));';
+CREATE CAST (interval AS text) WITH FUNCTION pg_catalog.text(interval) AS IMPLICIT;
+CREATE FUNCTION pg_catalog.text(bigint) RETURNS text STRICT IMMUTABLE LANGUAGE SQL AS 'SELECT textin(int8out($1));';
+CREATE CAST (bigint AS text) WITH FUNCTION pg_catalog.text(bigint) AS IMPLICIT;
+CREATE FUNCTION pg_catalog.text(numeric) RETURNS text STRICT IMMUTABLE LANGUAGE SQL AS 'SELECT textin(numeric_out($1));';
+CREATE CAST (numeric AS text) WITH FUNCTION pg_catalog.text(numeric) AS IMPLICIT;
+CREATE FUNCTION pg_catalog.text(timestamp without time zone) RETURNS text STRICT IMMUTABLE LANGUAGE SQL AS 'SELECT textin(timestamp_out($1));';
+CREATE CAST (timestamp without time zone AS text) WITH FUNCTION pg_catalog.text(timestamp without time zone) AS IMPLICIT;
Please sign in to comment.
Something went wrong with that request. Please try again.