On 06/02/2015 12:33 PM, Filipe Pina wrote:
Basically, in an (maybe-over)simplified example:
CREATE OR REPLACE FUNCTION add_transaction(transaction core_transaction)
RETURNS integer AS $$
DECLARE
transaction2 core_transaction;
BEGIN
transaction.field1 := 'lapse’;
transaction2.
Basically, in an (maybe-over)simplified example:
CREATE OR REPLACE FUNCTION add_transaction(transaction core_transaction)
RETURNS integer AS $$
DECLARE
transaction2 core_transaction;
BEGIN
transaction.field1 := 'lapse’;
transaction2.field2 := transaction.field2;
transaction2.fi
On 06/02/2015 03:10 AM, Filipe Pina wrote:
HI Adrian,
I had a typo in the email:
INSERT INTO my_table VALUES(my_table.*);
was actually
INSERT INTO my_table VALUES(my_var.*);
Aah, that is different:)
So I meant to insert the variable I had in memory (dict representing a row),
not the row
Thanks Rémi,
Indeed I needed something more generic and easy to maintain (regarding table
schema evolution) so I ended up going back to PL/PGSQL (for that specific
function) in the meantime.
> On 02/06/2015, at 09:41, Rémi Cura wrote:
>
> OUps,
>
> I forget another strategy I used :
> instea
HI Adrian,
I had a typo in the email:
INSERT INTO my_table VALUES(my_table.*);
was actually
INSERT INTO my_table VALUES(my_var.*);
So I meant to insert the variable I had in memory (dict representing a row),
not the rows from the table..
> On 02/06/2015, at 01:44, Adrian Klaver wrote:
>
>
OUps,
I forget another strategy I used :
instead of having
testp2(es employee[])
you can use
testp2( names text[], salaries integer[], ages integer[])
This might be the solution with the less work, but it is absolutely
terrible practice,
because it will be hard to change you record type (evoluti
Hey,
the only straight workaround I know (which is pretty bad)
is to cast down your record to text.
Then you have an array of text, which is manageable.
For this you can either 'flatten' your record into a unique text,
or cast each part of your record to text, then emulate an array of array
(you n
On 06/01/2015 07:42 AM, Filipe Pina wrote:
Thanks for the reply anyway, it's a pity though, it'd be useful..
Another bump I've found along the pl/python road: insert ROWTYPE in table..
Maybe you have some hint on that? :)
So, in PLPGSQL I can:
DECLARE
my_var my_table;
BEGIN
my_var.col1 :
Thanks for the reply anyway, it's a pity though, it'd be useful..
Another bump I've found along the pl/python road: insert ROWTYPE in
table..
Maybe you have some hint on that? :)
So, in PLPGSQL I can:
DECLARE
my_var my_table;
BEGIN
my_var.col1 := 'asd';
INSERT INTO my_table VALUES(my_table
On 5/18/15 10:52 AM, Filipe Pina wrote:
> But one of the functions I need to create needs to accept an array of
> records.
PL/Python doesn't support that. Some more code needs to be written to
support that. You did everything correctly. I don't know of a good
workaround.
--
Sent via pgsql-g
Hello,
I'm building an app in Django and I want to have some functions
directly in postgres. I'd prefer to use pl/python for the functions as
it'd look better in Django migration files (python code within python
code, instead of using PLPGSQL).
But one of the functions I need to create needs
11 matches
Mail list logo