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
feat: implement generated columns for postgres 12 driver #6469
Conversation
Ok, this is a problem. The tests are running on Postgres 9. However, this is a Postgres 12 feature. |
cecb1da
to
20863e2
Compare
Resolved the merge conflicts and adjusted the ci to also test Postgres 12. |
The implementation has the potential to make full text search much faster when using postgres. You can simply pre-generate all tsvector's
Generated columns are only available on postgres version 12+
Currently, there are only tests for postgres 9. This adds postgres 12 as test target
MariaDB will fail with a generated column type
Latest changes in master introduce replication mode. This commit adjust the the pull request typeorm#6469 to this change
20863e2
to
7ff79e2
Compare
Latest changes in master broke the postgres 12 test setup
5cfbc7d
to
3278244
Compare
Rebased and resolved conflicts. |
…TypeormGeneratedMetadataTable function imnotjames notice this in his review of the pull request
This return of Promise.resolve() has no effect. We can leave it out
Instead of parsing the version string with parseFloat, use the typeorm VersionUtils
It would be cool if this pr gets some love too, after so many prs got merged this week. |
Sorry your PR is on the last page of the list, that's why I never reach it, since I always start from the first page 😆 Let's figure out what to do - merge or close it, I'm going to review it. |
This is still open: https://github.com/typeorm/typeorm/pull/6469/files#r584112670 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All comments from previous review should be resolved before this can be merged.
Tests are failing btw |
Yes, I see it. Will try to solve it as soon as possible. |
Since tests are passing now, can this land soon? |
export enum MetadataTableType {
VIEW = "VIEW",
MATERIALIZED_VIEW = "MATERIALIZED_VIEW",
GENERATED_COLUMN = "GENERATED_COLUMN"
}
|
thank you for contribution! |
I am so happy this finally landed on master <3 |
* feat: implement generated columns for postgres 12 driver The implementation has the potential to make full text search much faster when using postgres. You can simply pre-generate all tsvector's * test: add tests for generated columns in postgres 12 * docs: document generated columns for postgres 12 * fix: check postgres version for generated columns Generated columns are only available on postgres version 12+ * test: add postgres 12 to tests Currently, there are only tests for postgres 9. This adds postgres 12 as test target * test: remove generated column from model MariaDB will fail with a generated column type * test: use non alpine container for postgres 12 * test: skip generated columns test on mariadb * fix: detect generated column change * fix: circle ci postgres version * fix: add replication mode to isGeneratedColumnsSupported() function Latest changes in master introduce replication mode. This commit adjust the the pull request typeorm#6469 to this change * fix: ci testing for postgres 12 Latest changes in master broke the postgres 12 test setup * style: remove SqlServerConnectionOptions generic parameter for createTypeormGeneratedMetadataTable function imnotjames notice this in his review of the pull request * style: remove unnecessary return of Promise.resolve() This return of Promise.resolve() has no effect. We can leave it out * style: fix whitespace issue for config.yml * refactor: use VersionUtils Instead of parsing the version string with parseFloat, use the typeorm VersionUtils * fix: fix failing build After merging the upstream into the pr fork, the build stopped working. The reason why the build fails, is because in the upstream one import is missing and one variable was removed * refactor: replace promise.all() with for loop * refactor: make requested changes * fix: update table name * fix: server version query and escape table column in queries * code refactoring * fixed lint issue * removed "enabledDrivers" from test Co-authored-by: Dmitry Zotov <dmzt08@gmail.com>
* feat: implement generated columns for postgres 12 driver The implementation has the potential to make full text search much faster when using postgres. You can simply pre-generate all tsvector's * test: add tests for generated columns in postgres 12 * docs: document generated columns for postgres 12 * fix: check postgres version for generated columns Generated columns are only available on postgres version 12+ * test: add postgres 12 to tests Currently, there are only tests for postgres 9. This adds postgres 12 as test target * test: remove generated column from model MariaDB will fail with a generated column type * test: use non alpine container for postgres 12 * test: skip generated columns test on mariadb * fix: detect generated column change * fix: circle ci postgres version * fix: add replication mode to isGeneratedColumnsSupported() function Latest changes in master introduce replication mode. This commit adjust the the pull request typeorm#6469 to this change * fix: ci testing for postgres 12 Latest changes in master broke the postgres 12 test setup * style: remove SqlServerConnectionOptions generic parameter for createTypeormGeneratedMetadataTable function imnotjames notice this in his review of the pull request * style: remove unnecessary return of Promise.resolve() This return of Promise.resolve() has no effect. We can leave it out * style: fix whitespace issue for config.yml * refactor: use VersionUtils Instead of parsing the version string with parseFloat, use the typeorm VersionUtils * fix: fix failing build After merging the upstream into the pr fork, the build stopped working. The reason why the build fails, is because in the upstream one import is missing and one variable was removed * refactor: replace promise.all() with for loop * refactor: make requested changes * fix: update table name * fix: server version query and escape table column in queries * code refactoring * fixed lint issue * removed "enabledDrivers" from test Co-authored-by: Dmitry Zotov <dmzt08@gmail.com>
@TheNoim Schema synchronization seems to fail.
On initial sync the columns seem to be generated correctly in the database and there is no issue. On second sync all generated columns fail. My decorator: Can you replicate this? |
I was hoping #4956 solves the issue. But it seems like it doesn't. Maybe I need to look into it a bit further. |
The implementation has the potential to make full-text search much faster when using Postgres. You can simply pre-generate all tsvector's.
Example:
Note:
My implementation is a bit different from the MySQL implementation. For me, it was important that a generated column only gets dropped and added again if the as expression changes. Maybe I should implement the same mechanic for the MySQL driver.