diff --git a/pkg/sql/logictest/testdata/logic_test/refcursor b/pkg/sql/logictest/testdata/logic_test/refcursor index 1055f9976c11..49f88a45955f 100644 --- a/pkg/sql/logictest/testdata/logic_test/refcursor +++ b/pkg/sql/logictest/testdata/logic_test/refcursor @@ -28,7 +28,7 @@ statement ok ALTER TABLE xy ADD COLUMN curs REFCURSOR; statement ok -INSERT INTO xy VALUES (1, 2, 'foo'); +INSERT INTO xy VALUES (1, 2, 'foo'::REFCURSOR); query IIT SELECT * FROM xy; @@ -38,14 +38,14 @@ SELECT * FROM xy; # Alter a column type to REFCURSOR. statement ok DROP TABLE IF EXISTS xy; -CREATE TABLE xy (x INT, y INT); +CREATE TABLE xy (x INT, y TEXT); SET enable_experimental_alter_column_type_general=true; statement ok ALTER TABLE xy ALTER COLUMN y TYPE REFCURSOR; statement ok -INSERT INTO xy VALUES (1, 'bar'); +INSERT INTO xy VALUES (1, 'bar'::REFCURSOR); query IT SELECT * FROM xy; @@ -60,10 +60,10 @@ INSERT INTO xy VALUES (3, 4); # Create a partial index that uses the REFCURSOR type. statement ok -CREATE INDEX part ON xy (x) WHERE y::REFCURSOR < '3'; +CREATE INDEX part ON xy (x) WHERE y::TEXT::REFCURSOR < '3'; query II -SELECT * FROM xy@part WHERE y::REFCURSOR < '3'; +SELECT * FROM xy@part WHERE y::TEXT::REFCURSOR < '3'; ---- 1 2 @@ -74,7 +74,7 @@ INSERT INTO xy VALUES (1, 2); # Add a check constraint that uses the REFCURSOR type. statement ok -ALTER TABLE xy ADD CONSTRAINT bar CHECK (y::REFCURSOR < 'baz'); +ALTER TABLE xy ADD CONSTRAINT bar CHECK (y::TEXT::REFCURSOR < 'baz'); query II SELECT * FROM xy; @@ -88,7 +88,7 @@ statement ok CREATE TYPE typ AS (x INT, y REFCURSOR); query T -SELECT (100, 'bar')::typ; +SELECT (100, 'bar'::REFCURSOR)::typ; ---- (100,bar) @@ -97,7 +97,7 @@ subtest function # Function that returns REFCURSOR. statement ok CREATE FUNCTION f() RETURNS REFCURSOR AS $$ - SELECT 'foo'; + SELECT 'foo'::REFCURSOR; $$ LANGUAGE SQL; query T @@ -111,7 +111,7 @@ DROP FUNCTION f; statement ok CREATE FUNCTION f() RETURNS REFCURSOR AS $$ BEGIN - RETURN 'foo'; + RETURN 'foo'::REFCURSOR; END $$ LANGUAGE PLpgSQL; @@ -130,7 +130,7 @@ CREATE FUNCTION f(curs REFCURSOR) RETURNS INT AS $$ $$ LANGUAGE SQL; query I -SELECT f('foo'); +SELECT f('foo'::REFCURSOR); ---- 0 @@ -145,7 +145,7 @@ CREATE FUNCTION f(curs REFCURSOR) RETURNS INT AS $$ $$ LANGUAGE PLpgSQL; query I -SELECT f('foo'); +SELECT f('foo'::REFCURSOR); ---- 0 @@ -186,7 +186,7 @@ DROP FUNCTION f; # Function that returns a composite type with REFCURSOR component. statement ok CREATE FUNCTION f() RETURNS typ AS $$ - SELECT (1, 'foo'); + SELECT (1, 'foo'::REFCURSOR); $$ LANGUAGE SQL; query T @@ -200,7 +200,7 @@ DROP FUNCTION f; statement ok CREATE FUNCTION f() RETURNS typ AS $$ BEGIN - RETURN (1, 'foo'); + RETURN (1, 'foo'::REFCURSOR); END $$ LANGUAGE PLpgSQL; @@ -221,4 +221,188 @@ foo statement error pgcode 42601 syntax error SELECT 'foo'::REFCURSOR(2); +# Testing casts. +statement ok +CREATE TABLE implicit_types ( + a TEXT, b CHAR, c VARCHAR, d NAME, e INT, f FLOAT, g DECIMAL, h BOOL, + i INTERVAL, j DATE, k TIMESTAMP, l REFCURSOR +); + +# Only the string types can be explicitly cast to REFCURSOR. +subtest explicit_cast_to + +query T +SELECT NULL::REFCURSOR; +---- +NULL + +query T +SELECT 'foo'::TEXT::REFCURSOR; +---- +foo + +query T +SELECT 'a'::CHAR::REFCURSOR; +---- +a + +query T +SELECT 'foo'::VARCHAR::REFCURSOR; +---- +foo + +query T +SELECT 'foo'::NAME::REFCURSOR; +---- +foo + +statement error pgcode 42846 pq: invalid cast: int -> refcursor +SELECT 1::INT::REFCURSOR; + +statement error pgcode 42846 pq: invalid cast: float -> refcursor +SELECT 1.0::FLOAT::REFCURSOR; + +statement error pgcode 42846 pq: invalid cast: decimal -> refcursor +SELECT 1.0::DECIMAL::REFCURSOR; + +statement error pgcode 42846 pq: invalid cast: bool -> refcursor +SELECT False::REFCURSOR; + +statement error pgcode 42846 pq: invalid cast: interval -> refcursor +SELECT '34h2s'::INTERVAL::REFCURSOR; + +statement error pgcode 42846 pq: invalid cast: date -> refcursor +SELECT '2015-08-30'::DATE::REFCURSOR; + +statement error pgcode 42846 pq: invalid cast: timestamp -> refcursor +SELECT '2015-08-30 03:34:45.34567'::TIMESTAMP::REFCURSOR; + +# Only the string types can be explicitly cast from REFCURSOR. +subtest explicit_cast_from + +query T +SELECT 'foo'::REFCURSOR::TEXT; +---- +foo + +query T +SELECT 'a'::REFCURSOR::CHAR; +---- +a + +query T +SELECT 'foo'::REFCURSOR::VARCHAR; +---- +foo + +query T +SELECT 'foo'::REFCURSOR::NAME; +---- +foo + +statement error pgcode 42846 pq: invalid cast: refcursor -> int +SELECT '1'::REFCURSOR::INT; + +statement error pgcode 42846 pq: invalid cast: refcursor -> float +SELECT '1.0'::REFCURSOR::FLOAT; + +statement error pgcode 42846 pq: invalid cast: refcursor -> decimal +SELECT '1.0'::REFCURSOR::DECIMAL; + +statement error pgcode 42846 pq: invalid cast: refcursor -> bool +SELECT 'False'::REFCURSOR::BOOL; + +statement error pgcode 42846 pq: invalid cast: refcursor -> interval +SELECT '34h2s'::REFCURSOR::INTERVAL; + +statement error pgcode 42846 pq: invalid cast: refcursor -> date +SELECT '2015-08-30'::REFCURSOR::DATE; + +statement error pgcode 42846 pq: invalid cast: refcursor -> timestamp +SELECT '2015-08-30 03:34:45.34567'::REFCURSOR::TIMESTAMP; + +# There are no implicit casts to REFCURSOR. +subtest implicit_cast_to + +statement ok +INSERT INTO implicit_types(l) VALUES (NULL); + +statement error pgcode 42804 pq: value type string doesn't match type refcursor of column \"l\" +INSERT INTO implicit_types(l) VALUES ('foo'::TEXT); + +statement error pgcode 42804 pq: value type char doesn't match type refcursor of column \"l\" +INSERT INTO implicit_types(l) VALUES ('a'::CHAR); + +statement error pgcode 42804 pq: value type varchar doesn't match type refcursor of column \"l\" +INSERT INTO implicit_types(l) VALUES ('foo'::VARCHAR); + +statement error pgcode 42804 pq: value type name doesn't match type refcursor of column \"l\" +INSERT INTO implicit_types(l) VALUES ('foo'::NAME); + +statement error pgcode 42804 pq: value type int doesn't match type refcursor of column \"l\" +INSERT INTO implicit_types(l) VALUES (1::INT); + +statement error pgcode 42804 pq: value type float doesn't match type refcursor of column \"l\" +INSERT INTO implicit_types(l) VALUES (1.0::FLOAT); + +statement error pgcode 42804 pq: value type decimal doesn't match type refcursor of column \"l\" +INSERT INTO implicit_types(l) VALUES (1.0::DECIMAL); + +statement error pgcode 42804 pq: value type bool doesn't match type refcursor of column \"l\" +INSERT INTO implicit_types(l) VALUES (False::BOOL); + +statement error pgcode 42804 pq: value type interval doesn't match type refcursor of column \"l\" +INSERT INTO implicit_types(l) VALUES ('34h2s'::INTERVAL); + +statement error pgcode 42804 pq: value type date doesn't match type refcursor of column \"l\" +INSERT INTO implicit_types(l) VALUES ('2015-08-30'::DATE); + +statement error pgcode 42804 pq: value type timestamp doesn't match type refcursor of column \"l\" +INSERT INTO implicit_types(l) VALUES ('2015-08-30 03:34:45.34567'::TIMESTAMP); + +# Only the strings types can be implicitly casted from refcursor. +subtest implicit_cast_from + +statement ok +INSERT INTO implicit_types(a) VALUES ('foo'::REFCURSOR); + +statement ok +INSERT INTO implicit_types(b) VALUES ('a'::REFCURSOR); + +statement ok +INSERT INTO implicit_types(c) VALUES ('foo'::REFCURSOR); + +statement ok +INSERT INTO implicit_types(d) VALUES ('foo'::REFCURSOR); + +statement error pgcode 42804 pq: value type refcursor doesn't match type int of column \"e\" +INSERT INTO implicit_types(e) VALUES ('1'::REFCURSOR); + +statement error pgcode 42804 pq: value type refcursor doesn't match type float of column \"f\" +INSERT INTO implicit_types(f) VALUES ('1.0'::REFCURSOR); + +statement error pgcode 42804 pq: value type refcursor doesn't match type decimal of column \"g\" +INSERT INTO implicit_types(g) VALUES ('1.0'::REFCURSOR); + +statement error pgcode 42804 pq: value type refcursor doesn't match type bool of column \"h\" +INSERT INTO implicit_types(h) VALUES ('False'::REFCURSOR); + +statement error pgcode 42804 pq: value type refcursor doesn't match type interval of column \"i\" +INSERT INTO implicit_types(i) VALUES ('34h2s'::REFCURSOR); + +statement error pgcode 42804 pq: value type refcursor doesn't match type date of column \"j\" +INSERT INTO implicit_types(j) VALUES ('2015-08-30'::REFCURSOR); + +statement error pgcode 42804 pq: value type refcursor doesn't match type timestamp of column \"k\" +INSERT INTO implicit_types(k) VALUES ('2015-08-30 03:34:45.34567'::REFCURSOR); + +query TTTTIRRBTTTT rowsort +SELECT * FROM implicit_types; +---- +NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +foo NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +NULL a NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +NULL NULL foo NULL NULL NULL NULL NULL NULL NULL NULL NULL +NULL NULL NULL foo NULL NULL NULL NULL NULL NULL NULL NULL + subtest end diff --git a/pkg/sql/sem/builtins/fixed_oids.go b/pkg/sql/sem/builtins/fixed_oids.go index 25654ead9509..c2c56e1f4176 100644 --- a/pkg/sql/sem/builtins/fixed_oids.go +++ b/pkg/sql/sem/builtins/fixed_oids.go @@ -2470,31 +2470,13 @@ var builtinOidsArray = []string{ 2499: `refcursorout(refcursor: refcursor) -> bytes`, 2500: `refcursorsend(refcursor: refcursor) -> bytes`, 2501: `refcursorrecv(input: anyelement) -> refcursor`, - 2502: `refcursor(time: time) -> refcursor`, - 2503: `refcursor(tsvector: tsvector) -> refcursor`, - 2504: `refcursor(date: date) -> refcursor`, - 2505: `refcursor(float: float) -> refcursor`, - 2506: `refcursor(decimal: decimal) -> refcursor`, - 2507: `refcursor(timestamp: timestamp) -> refcursor`, - 2508: `refcursor(void: void) -> refcursor`, - 2509: `refcursor(bool: bool) -> refcursor`, - 2510: `refcursor(bytes: bytes) -> refcursor`, - 2511: `refcursor(jsonb: jsonb) -> refcursor`, - 2512: `refcursor(timetz: timetz) -> refcursor`, - 2513: `refcursor(tsquery: tsquery) -> refcursor`, - 2514: `refcursor(bit: bit) -> refcursor`, - 2515: `refcursor(interval: interval) -> refcursor`, - 2516: `refcursor(string: string) -> refcursor`, - 2517: `refcursor(pg_lsn: pg_lsn) -> refcursor`, - 2518: `refcursor(int: int) -> refcursor`, - 2519: `refcursor(uuid: uuid) -> refcursor`, - 2520: `refcursor(inet: inet) -> refcursor`, - 2521: `refcursor(timestamptz: timestamptz) -> refcursor`, - 2522: `refcursor(box2d: box2d) -> refcursor`, - 2523: `refcursor(geometry: geometry) -> refcursor`, - 2524: `refcursor(oid: oid) -> refcursor`, - 2525: `refcursor(tuple: tuple) -> refcursor`, - 2526: `refcursor(geography: geography) -> refcursor`, + 2502: `refcursor(refcursor: refcursor) -> refcursor`, + 2503: `refcursor(string: string) -> refcursor`, + 2504: `bpchar(refcursor: refcursor) -> char`, + 2505: `char(refcursor: refcursor) -> "char"`, + 2506: `name(refcursor: refcursor) -> name`, + 2507: `text(refcursor: refcursor) -> string`, + 2508: `varchar(refcursor: refcursor) -> varchar`, } var builtinOidsBySignature map[string]oid.Oid diff --git a/pkg/sql/sem/builtins/pgformat/BUILD.bazel b/pkg/sql/sem/builtins/pgformat/BUILD.bazel index 23f5a40ece7b..3ea0da988274 100644 --- a/pkg/sql/sem/builtins/pgformat/BUILD.bazel +++ b/pkg/sql/sem/builtins/pgformat/BUILD.bazel @@ -43,6 +43,7 @@ go_test( "//pkg/util/log", "//pkg/util/randutil", "//pkg/util/timeutil", + "@com_github_lib_pq//oid", "@com_github_stretchr_testify//require", ], ) diff --git a/pkg/sql/sem/builtins/pgformat/format_test.go b/pkg/sql/sem/builtins/pgformat/format_test.go index cfb0ec728efb..266c4405cbd2 100644 --- a/pkg/sql/sem/builtins/pgformat/format_test.go +++ b/pkg/sql/sem/builtins/pgformat/format_test.go @@ -32,6 +32,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/util/leaktest" "github.com/cockroachdb/cockroach/pkg/util/log" "github.com/cockroachdb/cockroach/pkg/util/timeutil" + "github.com/lib/pq/oid" "github.com/stretchr/testify/require" ) @@ -59,6 +60,11 @@ func TestFormat(t *testing.T) { return true } } + if typ.Oid() == oid.T_refcursor { + // TODO(drewk): this case is temporarily skipped until we split REFCURSOR + // into its own family. + return true + } return !randgen.IsLegalColumnType(typ) } for _, typ := range types.OidToType { diff --git a/pkg/sql/sem/cast/cast_map.go b/pkg/sql/sem/cast/cast_map.go index b31b86a513e4..24be3ecd3693 100644 --- a/pkg/sql/sem/cast/cast_map.go +++ b/pkg/sql/sem/cast/cast_map.go @@ -36,12 +36,11 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_int8: {MaxContext: ContextExplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, oid.T_varbit: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_bool: { oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, @@ -54,27 +53,24 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, // Automatic I/O conversions to string types. - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oidext.T_box2d: { oidext.T_geometry: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_pg_lsn: { - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_bpchar: { oid.T_bpchar: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, @@ -82,8 +78,6 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_name: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, oid.T_text: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, oid.T_varchar: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, - // Automatic I/O conversions to string types. - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, // Automatic I/O conversions from bpchar to other types. oid.T_bit: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_bool: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, @@ -114,6 +108,7 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_numeric: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_oid: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_record: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_refcursor: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_regclass: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, oid.T_regnamespace: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, oid.T_regproc: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, @@ -157,12 +152,11 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ // Automatic I/O conversions to string types. // Casts from BYTEA to string types are stable, since they depend on // the bytea_output session variable. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, }, oid.T_char: { oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, @@ -170,8 +164,7 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_text: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, // Automatic I/O conversions to string types. - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, // Automatic I/O conversions from "char" to other types. oid.T_bit: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_bool: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, @@ -201,6 +194,7 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_numeric: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_oid: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_record: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_refcursor: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_regclass: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, oid.T_regnamespace: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, oid.T_regproc: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, @@ -282,13 +276,6 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ VolatilityHint: "DATE to VARCHAR casts are dependent on DateStyle; consider " + "using to_char(date) instead.", }, - oid.T_refcursor: { - MaxContext: ContextAssignment, - origin: ContextOriginAutomaticIOConversion, - Volatility: volatility.Stable, - VolatilityHint: "DATE to REFCURSOR casts are dependent on DateStyle; consider " + - "using to_char(date) instead.", - }, }, oid.T_float4: { oid.T_bool: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Immutable}, @@ -301,12 +288,11 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ // Automatic I/O conversions to string types. // Casts from FLOAT4 to string types are stable, since they depend on the // extra_float_digits session variable. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, }, oid.T_float8: { oid.T_bool: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Immutable}, @@ -319,12 +305,11 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ // Automatic I/O conversions to string types. // Casts from FLOAT8 to string types are stable, since they depend on the // extra_float_digits session variable. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, }, oidext.T_geography: { oid.T_bytea: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, @@ -332,12 +317,11 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oidext.T_geometry: {MaxContext: ContextExplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, oid.T_jsonb: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Immutable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oidext.T_geometry: { oidext.T_box2d: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, @@ -347,20 +331,18 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_jsonb: {MaxContext: ContextExplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, oid.T_text: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_inet: { oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, // Automatic I/O conversions to string types. - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_int2: { oid.T_bool: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Immutable}, @@ -381,12 +363,11 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_timestamp: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Immutable}, oid.T_timestamptz: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Immutable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_int4: { oid.T_bit: {MaxContext: ContextExplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, @@ -409,11 +390,10 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_timestamp: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Immutable}, oid.T_timestamptz: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Immutable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_int8: { oid.T_bit: {MaxContext: ContextExplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, @@ -435,12 +415,11 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_timestamp: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Immutable}, oid.T_timestamptz: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Immutable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_interval: { oid.T_float4: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Immutable}, @@ -482,12 +461,6 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ Volatility: volatility.Stable, VolatilityHint: "INTERVAL to VARCHAR casts depend on IntervalStyle; consider using to_char(interval)", }, - oid.T_refcursor: { - MaxContext: ContextAssignment, - origin: ContextOriginAutomaticIOConversion, - Volatility: volatility.Stable, - VolatilityHint: "INTERVAL to REFCURSOR casts depend on IntervalStyle; consider using to_char(interval)", - }, }, oid.T_jsonb: { oid.T_bool: {MaxContext: ContextExplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, @@ -500,20 +473,18 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_int8: {MaxContext: ContextExplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, oid.T_numeric: {MaxContext: ContextExplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_name: { oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, oid.T_text: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Leakproof}, oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, // Automatic I/O conversions to string types. - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, // Automatic I/O conversions from NAME to other types. oid.T_bit: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_bool: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, @@ -544,6 +515,7 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_numeric: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_oid: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_record: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_refcursor: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_regclass: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, oid.T_regnamespace: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, oid.T_regproc: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, @@ -590,12 +562,11 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_interval: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Immutable}, oid.T_numeric: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_oid: { // TODO(mgartner): Casts to INT2 should not be allowed. @@ -609,21 +580,19 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_regrole: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, oid.T_regtype: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_record: { // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, }, oid.T_refcursor: { // The REFCURSOR data type has no casts in the pg_cast table; all of its @@ -635,71 +604,6 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Leakproof}, oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - // Automatic I/O conversions from REFCURSOR to other types. - oid.T_bit: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_bool: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oidext.T_box2d: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_pg_lsn: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_bytea: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_date: { - MaxContext: ContextExplicit, - origin: ContextOriginAutomaticIOConversion, - Volatility: volatility.Stable, - VolatilityHint: "REFCURSOR to DATE casts depend on session DateStyle; use parse_date(string) instead", - }, - oid.T_float4: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_float8: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oidext.T_geography: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oidext.T_geometry: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_inet: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_int2: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_int4: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_int8: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_interval: { - MaxContext: ContextExplicit, - origin: ContextOriginAutomaticIOConversion, - Volatility: volatility.Stable, - VolatilityHint: "REFCURSOR to INTERVAL casts depend on session IntervalStyle; use parse_interval(string) instead", - }, - oid.T_jsonb: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_numeric: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_oid: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_record: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_regclass: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_regnamespace: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_regproc: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_regprocedure: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_regrole: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_regtype: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_time: { - MaxContext: ContextExplicit, - origin: ContextOriginAutomaticIOConversion, - Volatility: volatility.Stable, - VolatilityHint: "STRING to TIME casts depend on session DateStyle; use parse_time(string) instead", - }, - oid.T_timestamp: { - MaxContext: ContextExplicit, - origin: ContextOriginAutomaticIOConversion, - Volatility: volatility.Stable, - VolatilityHint: "STRING to TIMESTAMP casts are context-dependent because of relative timestamp strings " + - "like 'now' and session settings such as DateStyle; use parse_timestamp(string) instead.", - }, - oid.T_timestamptz: { - MaxContext: ContextExplicit, - origin: ContextOriginAutomaticIOConversion, - Volatility: volatility.Stable, - }, - oid.T_timetz: { - MaxContext: ContextExplicit, - origin: ContextOriginAutomaticIOConversion, - Volatility: volatility.Stable, - VolatilityHint: "STRING to TIMETZ casts depend on session DateStyle; use parse_timetz(string) instead", - }, - oid.T_tsquery: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_tsvector: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_uuid: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varbit: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_void: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_regclass: { // TODO(mgartner): Casts to INT2 should not be allowed. @@ -713,12 +617,11 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_regrole: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Stable}, oid.T_regtype: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Stable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, }, oid.T_regnamespace: { // TODO(mgartner): Casts to INT2 should not be allowed. @@ -732,12 +635,11 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_regrole: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Stable}, oid.T_regtype: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Stable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, }, oid.T_regproc: { // TODO(mgartner): Casts to INT2 should not be allowed. @@ -751,12 +653,11 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_regrole: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Stable}, oid.T_regtype: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Stable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, }, oid.T_regprocedure: { // TODO(mgartner): Casts to INT2 should not be allowed. @@ -770,12 +671,11 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_regrole: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Stable}, oid.T_regtype: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Stable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, }, oid.T_regrole: { // TODO(mgartner): Casts to INT2 should not be allowed. @@ -789,12 +689,11 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_regprocedure: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Stable}, oid.T_regtype: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Stable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, }, oid.T_regtype: { // TODO(mgartner): Casts to INT2 should not be allowed. @@ -808,12 +707,11 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_regprocedure: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Stable}, oid.T_regrole: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Stable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, }, oid.T_text: { oid.T_bpchar: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, @@ -834,8 +732,6 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ // then the TEXT OID, and we can remove this entry. oid.T_text: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, oid.T_varchar: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, - // Automatic I/O conversions to string types. - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, // Automatic I/O conversions from TEXT to other types. oid.T_bit: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_bool: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, @@ -865,6 +761,7 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_numeric: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_oid: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_record: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_refcursor: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_regnamespace: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, oid.T_regproc: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, oid.T_regprocedure: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, @@ -905,12 +802,11 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_time: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, oid.T_timetz: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Stable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_timestamp: { oid.T_date: {MaxContext: ContextAssignment, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, @@ -959,13 +855,6 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ VolatilityHint: "TIMESTAMP to VARCHAR casts are dependent on DateStyle; consider " + "using to_char(timestamp) instead.", }, - oid.T_refcursor: { - MaxContext: ContextAssignment, - origin: ContextOriginAutomaticIOConversion, - Volatility: volatility.Stable, - VolatilityHint: "TIMESTAMP to REFCURSOR casts are dependent on DateStyle; consider " + - "using to_char(timestamp) instead.", - }, }, oid.T_timestamptz: { oid.T_date: {MaxContext: ContextAssignment, origin: ContextOriginPgCast, Volatility: volatility.Stable}, @@ -1020,52 +909,41 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ VolatilityHint: "TIMESTAMPTZ to VARCHAR casts depend on the current timezone; consider " + "using to_char(t AT TIME ZONE 'UTC') instead.", }, - oid.T_refcursor: { - MaxContext: ContextAssignment, - origin: ContextOriginAutomaticIOConversion, - Volatility: volatility.Stable, - VolatilityHint: "TIMESTAMPTZ to REFCURSOR casts depend on the current timezone; consider " + - "using to_char(t AT TIME ZONE 'UTC') instead.", - }, }, oid.T_timetz: { oid.T_time: {MaxContext: ContextAssignment, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, oid.T_timetz: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_tsvector: { // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_tsquery: { // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_uuid: { oid.T_bytea: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Immutable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_varbit: { oid.T_bit: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, @@ -1074,12 +952,11 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_int8: {MaxContext: ContextExplicit, origin: ContextOriginLegacyConversion, Volatility: volatility.Immutable}, oid.T_varbit: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, // Automatic I/O conversions to string types. - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_varchar: { oid.T_bpchar: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, @@ -1088,8 +965,6 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_regclass: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Stable}, oid.T_text: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, oid.T_varchar: {MaxContext: ContextImplicit, origin: ContextOriginPgCast, Volatility: volatility.Immutable}, - // Automatic I/O conversions to string types. - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, // Automatic I/O conversions from VARCHAR to other types. oid.T_bit: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_bool: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, @@ -1120,6 +995,7 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_numeric: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_oid: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_record: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, + oid.T_refcursor: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, oid.T_regnamespace: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, oid.T_regproc: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, oid.T_regprocedure: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Stable}, @@ -1156,12 +1032,11 @@ var castMap = map[oid.Oid]map[oid.Oid]Cast{ oid.T_void: {MaxContext: ContextExplicit, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, oid.T_void: { - oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, - oid.T_refcursor: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_bpchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_char: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_name: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_text: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, + oid.T_varchar: {MaxContext: ContextAssignment, origin: ContextOriginAutomaticIOConversion, Volatility: volatility.Immutable}, }, } @@ -1173,7 +1048,6 @@ func init() { oid.T_char, oid.T_varchar, oid.T_text, - oid.T_refcursor, } isStringType := func(o oid.Oid) bool { for _, strOid := range stringTypes {