Saving view turns SELECT * into field list

2018-10-15 Thread Ben Uphoff
Hey team – I’m sure this has come up, but my search engine skills couldn’t find an explanation: Why, when I save a simple view like: SELECT * FROM a_table …does PostgreSQL turn the * into a field list like: SELECT field1, field2, field3, field4 FROM a_table ? This is super-frustrating, as it

Why is JSONB field automatically cast as TEXT?

2018-09-17 Thread Ben Uphoff
First post here at PostgreSQL; please forgive any etiquette mistakes… I have a query that extracts a field from a JSONB column, e.g.: SELECT (((mytable.ajsonbcolumn -> ‘somedata’) -> ‘nested’) ->> ‘first_name’) AS fname FROM mytable When I save it into a view, PostgreSQL transforms it thusly: