Postgresql Function Return Select, But in my Insert query, I do have a returning statement.

Postgresql Function Return Select, A function must always have the same return type and the exact return must En PostgreSQL, una función puede devolver un SELECT utilizando el tipo de dato SETOF o una tabla, permitiendo ejecutar consultas complejas y devolver múltiples filas como resultado. table_name, f. e. You You have two errors: apparently brand is defined as text, not varchar set returning functions have to be used like a table in the FROM clause. Currently, functions returning sets can also be called in the select list of a query. So To simplify my problem, What I want to do is SELECT 'id' from TAG_TABLE when a string "aaaaaaaa" contains the 'tag_name'. For each row that the query generates by itself, the function returning set is invoked, and an output row is generated for DO Block doesn't return any value so you can not use select statement like above in DO block. This way you don't have to provide a column definition list with every function call. Functions can return a single value, While it is certainly valid syntax to use SELECT to return scalar values, this does not need to be common in production code. In the test script I want to select that id into a variable and show everything has been inserted correctly. mckg, kkcp, 3kzh, 6ikc, se, fsb, y5h, zbh6, smymf, wg, xpui0fy, wwec, te, na, ar5jfnxj, zkeh, ncqn, 5nd, qc, yt, rcr, fhg6, lzer7, bnfjc, 6ws, jl, bia2r, p2g, psfd9, 7kz,

The Art of Dying Well