-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Waterline has very bad compatibility with PostgreSQL it's almost unusable #7310
Comments
@sudo-apt-get-updates Thanks for posting! We'll take a look as soon as possible. In the mean time, there are a few ways you can help speed things along:
Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly. For help with questions about Sails, click here. |
Another issue is that this:
Works in MariaDB. No issues at all. Then in PostgreSQL "communityUserSetting" returns a null. However this works:
Sails.js just seems to not work with PostgreSQL when it comes to populating. PostgreSQL version is 14. |
Hey @sudo-apt-get-updates that's interesting. I have been using Sails and PostgreSQL for Sailscasts with lots of |
Node version: v18.18.2
Sails version (sails): 1.5.8
DB adapter & version (e.g. sails-mysql@5.55.5): "sails-postgresql": "^5.0.1"
When migrating from MariaDB to PostgreSQL there are a lot of issues that have more to do with Waterline than it has to do with the differences in the databases. I use the official Sails.js migration tool to create the database, however when it performs the JOINs PostgreSQL throws an error with the hint, "Do you mean table____table__table__.createdat?". Notice the lower-case, this means that Sails.js is creating tables with double quotes such as "createdAt" but when it performs a JOIN for some reason it is not handling these double quotes correctly. A fix for this seems to be to enforce lower case on all columns, that's fine but there's an even larger issue that just makes Waterline not usable:
The error throws "invalid input syntax for type smallint: "true""
This is done via a .populate. So for example.
This is a very normal piece of code. Template finds id, then populates with "templateContents" and "templateComponents". However this throws the error: invalid input syntax for type smallint: "true". It works with MariaDB, it works with MongoDB. But the moment you switch to PostgreSQL it fails to work. Changing the columnType does not resolve the issue. The only thing that resolves it is removing "isHTML" and "isComponent". Both have the datatype "boolean" in it. This issue means that it's Waterline itself creating an issue when performing a JOIN operation. This is the isHTML, the isComponent is essentially the same.
And in Template (the following is also done for templateComponents):
And in JoinTemplateTemplateContent
The text was updated successfully, but these errors were encountered: