Skip to content

Fix Postgresql compatibility #2092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

alexandre-janniaux
Copy link

This merge request fixes a few PostgreSQL incompatibilities that I found when setting up Digiquali.

The main point here is changing strings in SQL, so as to use the standard single-quoting instead of the mysql double-quoting.

On the migration side there is also backtick-quoting for identifiers that is mysql-specific, the standard way being double-quoting.

There is one additional issue fixed around using "user" as a table identifier in some LEFT JOIN queries, which is not possible without double-quoting (ie. marking as an identifier) since "user" is a reserved keyword in postgresql.

alexandre-janniaux and others added 15 commits April 10, 2025 20:16
Backticks to indicate identifiers is non-standard and not compatible
with PostgreSQL nor patched by Dolibarr migration handler.
`user` is a reserved keyword in postgresql. To indicate we want "user"
as an identifier, we need to double-quote it as such. Since it's coming
from a table, quote every identifier there.

Quoting identifiers is a standard SQL syntax and will work on other
DBMS engines.
Postgresql and standard SQL requires single 'quoting' for strings.
Postgresql and standard SQL requires single 'quoting' for strings.
Postgresql and standard SQL requires single 'quoting' for strings.
@alexandre-janniaux alexandre-janniaux force-pushed the postgres-compatibility branch from 5ab6e41 to 6333a5b Compare May 2, 2025 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant