postgres and python

后端 未结 4 1225
-上瘾入骨i
-上瘾入骨i 2021-02-18 16:45

In postgres 9.2 I am trying to create a python program that can be a trigger. I want to run an external program (an exe on the local disk) so I am using python to run it. Whe

相关标签:
4条回答
  • 2021-02-18 17:00

    I'm installed python 3.2(x64) y postgres 9.3 (x64)

    Execute this code CREATE EXTENSION plpython3u

    Do not forget to check the "installation-note.html" your version of postgresSQL there are specific python version for your postgresSQL

    0 讨论(0)
  • 2021-02-18 17:05

    I have just solved this problem, literally a few days back. The solution is quite involved. Here it goes.

    1. Install python 3.2.* version only on your system.
    2. In Postgresql use the 'CREATE LANGUAGE plpython3u' command to install Python 3 language support. More often than not, it will give the following error "unable to load ".....\plpython3.dll" error 126. (Note if it installs correctly, no error will be displayed.)

    3. In case you get the above error, goto your python installation directory (default is C:\python32) and look for "python3.dll" in the DLL's folder. Copy this file to your Postgresql 'lib' folder in the installation directory of Postgres (default is c:\program files\postgres\9.x\lib\"). Rename this copied file to python32.dll.

    4. Now run the 'CREATE LANGUAGE plpython3u' command again. It should work this time.

    To verify, check out the pg_available_extensions view in the system tables of postgresql. The row containing plpython3u should have a version number in the 'installed version' column.

    Note : This only works for plpython3u language. I do not know any similar process for plpython2u.

    0 讨论(0)
  • 2021-02-18 17:15

    Postgres uses the ActiveState distros of Python. Most likely, your 2.5 is too outdated and Postgres cant load the plpython dll or didn't install it because there was no suitable python. I think recent postgres is buil6 against Python3 not 2.x. You can look in the postgres lib directory for plpython3.dll to find out what you need.

    0 讨论(0)
  • 2021-02-18 17:27

    To resolve this for plpython3, it was necessary to:

    • Install Python 3.2
    • Run CREATE LANGUAGE plpython3u

    Update: I've written a much better explanation here: https://stackoverflow.com/a/24218449/398670

    0 讨论(0)
提交回复
热议问题