I would like to create a function which returns with a table, but I would like to add default values to the values, like this:
CREATE OR REPLACE FUNCTION cleanDatabase()
RETURNS TABLE
(
error TEXT,
createConnection TEXT,
dropDatabases TEXT DEFAULT 'OK',
dropTableSpaces TEXT,
closeConnection TEXT
)
AS $$
...
But I get the following error: ERROR: syntax error at or near "DEFAULT"
I use default keyword often when I create new tables and it is working fine. Is it just not a use case what I am doing here, and I should just create a temporary table with defaults and return with that one?