Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: using prefix 'E' to force enable escaping backslash (#1631)

h3n4l89e83c2a69fd
diff --git a/plugin/db/pg/sync.go b/plugin/db/pg/sync.go
index ba580d44a7..46d86ebc00 100644
--- a/plugin/db/pg/sync.go
+++ b/plugin/db/pg/sync.go
@@ -317,7 +317,7 @@ func getTable(txn *sql.Tx, tbl *tableSchema) error {
}
}
- commentQuery := fmt.Sprintf(`SELECT obj_description('"%s"."%s"'::regclass);`, tbl.schemaName, tbl.name)
+ commentQuery := fmt.Sprintf(`SELECT obj_description(E'"%s"."%s"'::regclass);`, tbl.schemaName, tbl.name)
crows, err := txn.Query(commentQuery)
if err != nil {
return err
@@ -463,7 +463,7 @@ func getViews(txn *sql.Tx) ([]*viewSchema, error) {
// getView gets the schema of a view.
func getView(txn *sql.Tx, view *viewSchema) error {
- query := fmt.Sprintf(`SELECT obj_description('"%s"."%s"'::regclass);`, view.schemaName, view.name)
+ query := fmt.Sprintf(`SELECT obj_description(E'"%s"."%s"'::regclass);`, view.schemaName, view.name)
rows, err := txn.Query(query)
if err != nil {
return err
@@ -544,7 +544,7 @@ func getIndices(txn *sql.Tx) ([]*indexSchema, error) {
}
func getIndex(txn *sql.Tx, idx *indexSchema) error {
- commentQuery := fmt.Sprintf(`SELECT obj_description('"%s"."%s"'::regclass);`, idx.schemaName, idx.name)
+ commentQuery := fmt.Sprintf(`SELECT obj_description(E'"%s"."%s"'::regclass);`, idx.schemaName, idx.name)
crows, err := txn.Query(commentQuery)
if err != nil {
return err