在windows postgresql中生成uuid

发布于 2024-10-01 13:30:23 字数 150 浏览 1 评论 0原文

我在 Windows 上安装了 postgresql 9,它没有内置的 uuid 生成器。有 OSSD 包,它可以绑定到 postgresql 作为 uuid 生成器,但它仅适用于 *nix (我认为)。

如何在 Windows postgresql 中生成 uuid?

I have a postgresql 9 installation on windows, which doesn't have built in uuid generator. There is OSSD package, which can be bound to postgresql as uuid generator, but it's for *nix only (I think).

How can I generate uuid in windows postgresql?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

七七 2024-10-08 13:30:24

贡献中的 uuid-ossp-module 确实可以工作Windows XP 32 位。 64 位版本尚不可用,OSSP UUID 库项目必须解决此问题。

The uuid-ossp-module in the contrib, does work on Windows XP 32 bits. The 64 bits version is not available yet, the OSSP UUID library project has to fix this problem.

留一抹残留的笑 2024-10-08 13:30:24

在 Windows 上,我执行了以下操作来生成 UUID:

在命令提示符下使用此命令登录服务器:

psql -U postgres

这基本上是以 root 身份访问 PostgreSQL。

然后选择您希望此函数可用的数据库:

postgres=# \c <name of database>

然后执行以下命令:

CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

然后立即执行进行测试:

SELECT uuid_generate_v4();

我建议您查看 uuid-ossp 有关可用 UUID 函数的文档。

On windows, I did the following to generate UUIDs:

Log into the server using this command on Command Prompt:

psql -U postgres

This is basically accessing PostgreSQL as root.

Then select the database you want this function to be available in:

postgres=# \c <name of database>

Then execute the following:

CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

Then test by immediately executing:

SELECT uuid_generate_v4();

I recommend you review the uuid-ossp documentation on the available UUID functions.

樱花落人离去 2024-10-08 13:30:23

EnterpriseDB 的一键安装程序确实有它。该 DLL 名为“uuid-ossp.dll”,驻留在“(Postgres 的安装目录)\lib”中,安装 SQL 脚本名为“uuid-ossp.sql”,驻留在“(Postgres 的安装目录)\share”中\贡献”。您必须执行您选择的数据库中的最后一个。

The one-click installer from EnterpriseDB does have it. The DLL is called "uuid-ossp.dll" and resides in "(Postgres' installation directory)\lib" and the installation SQL script is called "uuid-ossp.sql" and resides in "(Postgres' installation directory)\share\contrib". You have to execute the last one in the DB of your choice.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文