Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgreSQL could not load a library. Unknown error 14001

CREATE FUNCTION uuid_generate_v1()
RETURNS uuid
AS '$libdir/uuid-ossp', 'uuid_generate_v1'
VOLATILE STRICT LANGUAGE C;

I get this error when I run this script. What does this error mean and how can I rectify it? Postgres user has full access to postgresql folder. I also tried to run it on a real Windows 2003 Server machine with the same result.

The library path is C:\PostgreSQL\9.1\lib\uuid-ossp.dll

PostgreSQL-9.1.2-1, WindowsXP SP3 (VirtualBox).

like image 336
bartolo-otrit Avatar asked Nov 17 '25 06:11

bartolo-otrit


2 Answers

Thank God the problem is solved.

uuid-ossp from PostgreSQL 9.2 requires MSVCRT.DLL v7.0.2600.5512. It's needed to install "Microsoft Visual C++ 2008 Redistributable Package". After that Windows\WinSxS should contain manifests and policies for this library with names like x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_x-ww_d08d0375, then uuid-ossp should work correctly.

It's worth noting that the PostgreSQL installation directory should have write permissions for users group to work correctly under Windows XP

like image 181
bartolo-otrit Avatar answered Nov 20 '25 04:11

bartolo-otrit


Having encountered this problem with postgresql-9.0.6, we solved it by recompiling uuid-ossp extension from the official postgresql distribution using a patched uuid library from here (I suppose you should build this library by yourself too).

It should be noted that this has been performed on genuine Windows, while pirated versions do not have this problem.

like image 29
Igel Avatar answered Nov 20 '25 02:11

Igel