I postgres, can I pass a row of specific table as argument to a function?
- User
I postgres, can I pass a row of specific table as argument to a function?
Assistant
Yes, in PostgreSQL you can pass a row of a specific table as an argument to a function — and it's quite straightforward.
✅ How to do it
You can define a function that accepts a parameter of the table's row type, which is automatically available as a composite type with the same name as the table.
🔧 Example
Suppose you have a table:
sqlCREATE TABLE users ( id serial PRIMARY KEY, name text, email text );
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.