pgcat icon indicating copy to clipboard operation
pgcat copied to clipboard

Allow plugins and query_parser_read_write_splitting without globally enabling query_parser_enabled

Open adis-io opened this issue 8 months ago • 0 comments

Summary

With this PR it will be possible to use it following way

Config:

query_parser_enabled = false
query_parser_read_write_splitting = true

Example:

SET SERVER ROLE to 'auto' -- it will enable query parser in place
SET PRIMARY READS TO 'off' -- it will disable reads from primary
SELECT * FROM users WHERE id = <id> LIMIT 1
-- any other reads

-- following statement will be routed to primary and succeed
UPDATE users SET updated_at = NOW() WHERE id = 1

SET PRIMARY READS TO 'default' -- return default value
SET SERVER ROLE to 'default' -- return default role

Without query_parser_read_write_splitting auto will randomly route to primary and replica

Let me know what do you think about it.

adis-io avatar May 20 '25 08:05 adis-io