I'm looking to union two tables together with slightly different columns. IN the past I have just added the additional columns to the smaller table and used select null as col3
.
In this recent example the column is an array and selecting null creates a string not an array data type.
I have tried select ARRAY[null] as col3
but the result is not a null or empty array, its an array with the value null inside. You can check the array length and see that the legnth is 1 not 0.
SELECT col1, col2, null as col3 FROM tbl1
UNION ALL
SELECT col1, col2, col3 FROM tbl2