Menu

PostgreSQL PREPARE can't CALL stored procedures, but you can still bind and prepare CALL myproc($1)
📰

PostgreSQL PREPARE can't CALL stored procedures, but you can still bind and prepare CALL myproc($1)

DEV Community: postgres·Franck Pachot·1 day ago
#NlAyqYlL
#devtopostgresql#devto#dev#call#values
Long article (3278 words) — no AI summary yet.
Reading 0:00
15s threshold

Tom Kyte's classic advice — "use bind variables" — isn't Oracle-specific. For OLTP, you should define the operation once and pass changing data as parameters, rather than constructing new executable SQL for every request.

This improves security, as recommended by OWASP's SQL Injection Prevention Cheat Sheet , and lets the database recognize and reuse a stable operation. At the service level it fits Martin Fowler's Remote Facade : expose well-defined, coarse-grained operations with explicit arguments.

Bind values, reuse operations, validate and authorize inputs, and monitor statement cardinality and observability.

The solution has been known for decades, yet in many applications changing inputs still become a new SQL string on every request.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.