PostgreSQL SET Operations
PostgreSQL SET Operations is a SQL function in the PostgreSQL Specific category. PostgreSQL configuration: SET/SET_CONFIG for session/local settings. SHOW/CURRENT_SETTING to read current values. The syntax is SELECT set_config('schema', 'public', true); SELECT current_setting('timezone');. It accepts see syntax. It returns configuration value. A typical example: -- Session-level settings: SET search_path TO sales, public; SET work_mem = '256MB'; SET statement_timeout = '30s'; -- Function-based: SELECT set_config('work_mem', '128MB', false); -- false = session-level, true = transaction-level -- Read settings: SHOW work_mem; -- 128MB SELECT current_setting('work_mem'); -- 128MB -- Transaction-level (auto-resets on COMMIT/ROLLBACK): SET LOCAL enable_seqscan = OFF; SELECT * FROM employees WHERE id = 5; COMMIT; -- enable_seqscan reverts to default A close relative is SERIAL, which postgreSQL auto-increment type. Creates an INTEGER column with a sequence. Equivalent to AUTO_INCREMENT in MySQL. A close relative is RETURNING, which postgreSQL extension that returns values from INSERT/UPDATE/DELETE statements (like OUTPUT in SQL Server).