Skip to content

Latest commit

 

History

History
20 lines (17 loc) · 564 Bytes

20210323162128-prepared_sql_statements.org

File metadata and controls

20 lines (17 loc) · 564 Bytes

Prepared SQL statements

aka Parameterized Query

PREPARE foo(int) AS
  SELECT * FROM users where id = $1;
EXECUTE foo(1);
DEALLOCATE foo;
  • Prepared statements only last for the duration of the current database session, but can be cleaned up manually with DEALLOCATE
  • See Postgres PREPARE