Closed developerDemetri closed 1 year ago
Hi @developerDemetri, thanks for the detailed write-up. Please have a look at #925 and let me know if this works for you...bonus points if you can take it for a spin against a PostgreSQL db 😄
Hi @developerDemetri, thanks for the detailed write-up. Please have a look at #925 and let me know if this works for you...bonus points if you can take it for a spin against a PostgreSQL db 😄
Thanks @aka-bo, I confirmed that #925 fixes this issue (against my local PostgreSQL instance) by:
sql.go
locallymetastore := NewSQLMetastore(db, WithSQLMetastoreDBType(Postgres))
Thanks for confirming @developerDemetri, we should be able to get a new release rolled out shortly.
Describe the bug When using
github.com/godaddy/asherah/go/appencryption v0.2.6
'sSQLMetastore
on Go 1.20.x withgithub.com/jackc/pgx/v5
as thedatabase/sql
driver, SQL queries fail with invalid syntax errors. eg.This appears to be a PostgreSQL syntax issue with the
loadKeyQuery
,storeKeyQuery
, andloadLatestQuery
placeholders: https://github.com/jackc/pgx/issues/1265The following diff resolves the issue, verified by copy + pasting sql.go locally and updating
I'm happy to contribute a fix, but I need to know how maintainers would like to manage the MySQL vs PostgreSQL query strings in a seamless and backwards compatible fashion?
Maybe I could add an optional parameter to
NewSQLMetastore
that sets the correct set of query strings?To Reproduce Call
Encrypt()
with aSQLMetastore
that uses a PostgreSQL driver such asgithub.com/jackc/pgx/v5
.Expected behavior
SQLMetastore
works for all common PostgreSQL and MySQL drivers without hitting query syntax errors.