Skip to content
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

PostgreSQL UUID #3009

Closed
GitStorageOne opened this issue Oct 29, 2018 · 12 comments
Closed

PostgreSQL UUID #3009

GitStorageOne opened this issue Oct 29, 2018 · 12 comments

Comments

@GitStorageOne
Copy link

GitStorageOne commented Oct 29, 2018

Issue type:

[ ] question
[ ] bug report
[x] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[x] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[ ] latest
[ ] @next
[x] 0.2.8 (or put your version here)

Steps to reproduce or a small repository showing the problem:

Historically this module depended on the OSSP UUID library, which accounts for the module's name. While the OSSP UUID library can still be found at http://www.ossp.org/pkg/lib/uuid/, it is not well maintained, and is becoming increasingly difficult to port to newer platforms.

If you only need randomly-generated (version 4) UUIDs, consider using the gen_random_uuid() function from the pgcrypto module instead.

Source.

So, when @PrimaryGeneratedColumn('uuid') used, seems it's recommended to use another extension.

By the way, how to change the name of constraint that PrimaryGeneratedColumn create?

@gintsgints
Copy link

I will check this.

@gintsgints
Copy link

This could be kind of breaking change. Because new library does not support older versions of postgres:
9.2 / 9.1 / 9.0 / 8.4 / 8.3

gintsgints pushed a commit to gintsgints/typeorm that referenced this issue Nov 3, 2018
New extension does not support Old postgres versions: 9.2 / 9.1 / 9.0 / 8.4 / 8.3
@GitStorageOne
Copy link
Author

9.2 is 8 years old, who still use it?
If there is any, suppose that such people are not using Typescript :)
For ORM that on TOP EDGE of technology, so old RDBMS should not be the cause of freeze.
More over, it's good idea to support new DBMS features to improve speed and security, and support backward compatibility for 2 years (few versions of previous DBMS), then freely use new features.

Also, it's possible to get DB version and use proper extension.
But in case of this thread, better choice wold be to drop support of PG lower than 9.6.

I also like to support every version of OS when developing software with any version of DBMS, but it's way to unnecessary complications for small teams, because in same time software should support new features.

gintsgints pushed a commit to gintsgints/typeorm that referenced this issue Nov 4, 2018
New extension does not support Old postgres versions: 9.2 / 9.1 / 9.0 / 8.4 / 8.3

Fixed test
gintsgints pushed a commit to gintsgints/typeorm that referenced this issue Nov 4, 2018
New extension does not support Old postgres versions: 9.2 / 9.1 / 9.0 / 8.4 / 8.3
@gintsgints
Copy link

gintsgints commented Nov 4, 2018

@GitStorageOne that's all fine. I just tought may be it should be mentioned somewhere in TypeORM docs.

gintsgints pushed a commit to gintsgints/typeorm that referenced this issue Nov 28, 2018
New extension does not support Old postgres versions: 9.2 / 9.1 / 9.0 / 8.4 / 8.3
@gintsgints
Copy link

@pleerock what about we use module https://www.npmjs.com/package/uuid for this? That would fit all database dialects.

@typokign
Copy link
Contributor

@GitStorageOne I know this is super late but this is fixed in v0.2.15 - you can now specify uuidExtension: 'pgcrypto' in your Postgres connection settings.

@vlapo
Copy link
Contributor

vlapo commented Mar 12, 2019

Close this as #3537 is merged. More info in docs.

@vlapo vlapo closed this as completed Mar 12, 2019
@JaffParker
Copy link

Sorry to have to reopen this again, but I'm specifying uuidExtension: 'pgcrypto', but TypeoORM is still trying to use the uuid_generate_v4() function and consequently crashes. How do I verify that the config option works?

@vlapo
Copy link
Contributor

vlapo commented May 19, 2019

What version of typeorm do you use? How does your connection config look?

@JaffParker
Copy link

@vlapo I had to update my TypeORM and forgot to mention it in this issue. It's resolved

@Ericnr
Copy link

Ericnr commented Jan 7, 2020

I'm using the typeORM@latest and postgresql 11.5 but yet uuidExtension: 'pgcrypto' doesn't seem to install any extensions.
Only CREATE EXTENSION pgcrypto fixed it, now I see it when I do \dx

@benjaminudoh10
Copy link
Contributor

This fixed the issue for me:
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

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

No branches or pull requests

7 participants