Re: Installing support for python on windows - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Installing support for python on windows
Date
Msg-id 200612311439.25024.aklaver@comcast.net
Whole thread Raw
In response to Installing support for python on windows  (novnov <novnovice@gmail.com>)
Responses Re: Installing support for python on windows  (novnov <novnovice@gmail.com>)
List pgsql-general

On Sunday 31 December 2006 2:09 pm, novnov wrote:

> I've spent a couple of hours on this and would like to ask for an assist at

> this point. I need to install python support on windows. The postgresql

> install is the windows 8.2.0-1 binary, and pl/pgsql was included in the

> initial installation. I have python 2.5 installed. The workstation's path

> does not ref either the python or postgres directories.

>

> - I take it that plpython is what I should be installing? I first read in

> this list that psycopg is commonly used to work with python in postgres,

> and I installed the windows port of that, but 'nothing happened' ie no

> python lang support materialized. I'm not at all sure what the score is

> with psycopg and plpython, but am now aiming for plpython as that seems to

> be the offering that is included with the postgres installer. But I'm

> curious, why psycopg when plpython is there? Are they complimentary, or

> should it be one or the other?

Psycopg is an interface from Python to Postgres. In other words it works from the outside. You use it to connect a Postgres database and manipulate data as needed. plpython is a procedural language for Postgres that allows one to use Python from within the server. For what you want to do plpython is the choice.

>

> - The postgresql docs reference plpythonu (untrusted) but what I find in

> \lib is plpython? Are the docs out of date or am I mixing up information?

> (http://www.postgresql.org/docs/8.2/interactive/plpython.html)

>

I haven't installed Postgres on Windows so I am not familiar with the naming there. At one time there was a plpython but this has been replaced by plpythonu as Python did not have a robust mechanism for keeping the language from straying outside the server.

> - Per most docs the installation of a language is done with createlang.

> I've tried many times and cannot get the syntax right. Typically I log in

> to psql in the \bin directory as the main postgres user. After that, a

> typical attempt is looks like this:

>

> postgres=# createlang 'd:\postgresql\lib\plpython' mydb;

>

> Typical error is:

> ERROR: syntax error at or near "createlang"

> LINE 1: createlang d:

>

> This is a later attempt where I've added the lib path. I've tried no path,

> double quotes, many things. I've tried executing from the windows command

> line (ie not while in psql), adding the dll extension. Rather than spending

> the rest of the year on this (ie ten hours <g>) I hope someone can knock

> out a line or two to steer me in the right direction.

Just for reference sake, did you try createlang -d mydb plpythonu

See URL below for more information

http://www.postgresql.org/docs/8.2/interactive/app-createlang.html

--

Adrian Klaver

aklaver@comcast.net

pgsql-general by date:

Previous
From: "John Cohorn"
Date:
Subject: Application validation of data on insert
Next
From: Tom Lane
Date:
Subject: Re: Installing support for python on windows