toluaina / pgsync

Postgres to Elasticsearch/OpenSearch sync
https://pgsync.com
MIT License
1.16k stars 180 forks source link

Bootstrap failure with schema containing PostgreSQL reserved Word (e.g. 'user') #487

Open sagitsofan opened 1 year ago

sagitsofan commented 1 year ago

PGSync version: latest

Postgres version:

Elasticsearch version:

Redis version:

Python version:

Problem Description:

Encountering failure in Bootstrap process with schema utilizing PostgreSQL reserved word (e.g. "user")

The issue pertains to the failure of the Bootstrap process when attempting to utilize a schema that incorporates a reserved word from PostgreSQL. An exemplar case is the usage of a schema named "user," which triggers an error during the Bootstrap procedure. This obstacle prevents the successful initiation of the Bootstrap process. Also, when having a schema containing "-" for example "some-schema-name" bootstrap is failing as well, it should be wrapped with double quotes.

Error Message (if any):

1

syntax error at or near "user"
CREATE OR REPLACE FUNCTION user.table_notify() RETURNS TRIGG..

2

syntax error at or near "some-schema-name"
CREATE OR REPLACE FUNCTION some-schema.table_notify() RETURNS TRIGG..