Questions tagged [plpy]
8 questions
3
votes
1 answer
What does plpy.notice(msg) do?
Is it just a plain print to screen? if it is why not simply use simple console print command?
I've looked it up and there isn't much information about it. Even in the official PostgreSQL guide there isn't information about it other than the fact it…

John
- 1,724
- 6
- 25
- 48
3
votes
1 answer
Can i share composite types across postgres and plpython
I have a composite type called tt to be used by all my plpgsql and plpythonu
procedures. is there some kind of plpy. means of accessing the catalogue or
schema in a consistent way so as to derive types or iterable structs to return
without having to…

usbdongle
- 81
- 6
2
votes
1 answer
Call postgres PL/Python stored function from another PL/Python block
Is it possible to call PL/Python function from other PL/Python block as a normal Python function.
For example, I have a function f1:
create or replace function f1() returns text as $$
return "hello"
$$ language 'plpython3u';
I want call this…

lodopidolo
- 175
- 2
- 10
0
votes
1 answer
PLPython & CAST composite data type in Postgresql
I am writing a stored procedure in PlPython with a user defined type. I know Plpython does not support user defined types, so, I have created a CAST for the user defined type. Still I keep getting an error when I call plpy.prepare. I am not sure if…

rhm2012
- 554
- 1
- 5
- 8
0
votes
1 answer
mapping in SD in python
Hi I want to map the sd keys and values from the result of two different query. to make it more clear i have written code.
rv = plpy.execute(select id from ABC);
if this returns 1, 2, 3
rv = plpy.execute(select name from XYZ);
if this returns…

Rohita Khatiwada
- 2,835
- 9
- 40
- 52
0
votes
1 answer
How to store two different values returned from query into list data types to be used later(plpy python)
I need to store two values, "id" and "name" returned from sql query into a variable which I can use later. Can I use list for this purpose. I want to store values from sql at once and then only to refer to the stored value. I was able to do so but…

Rohita Khatiwada
- 2,835
- 9
- 40
- 52
0
votes
0 answers
PostgreSQL - select..where: syntax when value could be null
I am looking for the correct way to format a query so that a value in the 'where' clause can be null.
I tried this:
getTxCount = plpy.prepare("""
select count(*) from trade_tx_tbl
where account_name = $1
and trade_date …

Crashmeister
- 375
- 1
- 14
0
votes
1 answer
PostgreSQL with Python catching exceptions with plpy.SPIError
how to properly catch the exception with plpy.SPIError,
notation:
try:
# code
except plpy.SPIError,e:
plpy.notice(e)
results in an error
DETAIL: SyntaxError: invalid syntax (, line 99)
PostgreSQL 9.2 ,
PL / Python 3.2

pyer
- 85
- 1
- 1
- 6