nucleuscloud / neosync

Open source data anonymization and synthetic data orchestration for developers. Create high fidelity synthetic data and sync it across your environments.
https://www.neosync.dev
Other
3.34k stars 119 forks source link

[NEOS-1396] Add support for double quotes in schema and tables for Postgres #2591

Open nickzelei opened 2 months ago

nickzelei commented 2 months ago

We have support for special characters, however, this breaks down when building many of our queries because double quotes need to be escaped properly, which is done by adding an extra double quote.

CREATE TABLE "user""s_data@" (id TEXT NOT NULL PRIMARY key);

This creates a table called user"s_data@

Goqu only knows how to wrap tables in the correct delimiter (for Postgres, it is a double quote), but in order for the statement to be valid, we have to add in an extra " wherever we find one.

This change will have to be made anywhere that we are using Goqu.

Well known places:

Keep an eye out for:

Add support for escaping double quotes in Postgres Identifiers · Issue #428 · doug-martin/goqu

From SyncLinear.com | NEOS-1396