View Source Electric.Replication.Eval.Env.ImplicitCasts (electric v0.9.5)

List of all implicit casts in (raw) PostgreSQL. Does not account for custom casts, which are discouraged anyway. If needed, this list can be extended in Electric.Replication.Eval.Env.new/1

This list of implicit casts functions as-is, meaning that in Elixir land, we can just "relabel" the type, without doing any actual conversion, and it will work.

Types are always considered implicitly castable to themselves (as in PG code), but three casts are missing from this list: time to timetz, timestamp to timestamptz, and date to timestamptz. Reason for this is that the implicit cast appends a timezone of the server to the original type, which is not something that makes a whole lot of sense to do on Electric.

Duplicated source and target usually mean that there is some property of the type that may be present (e.g. length of the bit type, or precision of interval) but shouldn't interfere with casting

List of implicit casts

sourcetargetsfunction name
bitvarbit,bit
bpchartext,name,varchar,bpchar
chartext
cidrinet
datetimestampdate_to_timestamp
float4float8
int2float8,int8,int4,numeric,float4
int4float4,float8,numeric,int8
int8float8,float4,numeric
intervalinterval
macaddrmacaddr8
macaddr8macaddr
nametext
numericnumeric,float8,float4
textbpchar,varchar,name
timeinterval
timetime
timestamptimestamp
timestamptztimestamptz
timetztimetz
varbitvarbit,bit
varcharname,text,bpchar,varchar

Summary

Functions