leafo / pgmoon

A pure Lua Postgres driver for use in OpenResty & more
MIT License
395 stars 93 forks source link

select custom function in postgresql not working. #85

Closed cqlangyi closed 5 years ago

cqlangyi commented 5 years ago

hi there,

thank you for the cool work of pgmoon.

i got a issue here, just wonder if i could get a hand here.

i defined a custom function in postgresql with plpgsql, eg.

create table test (id int, name text, uuid uuid);

create function a_function () return uuid as $$ declare nuuid uuid; begin insert into test(100, 'name1', uuid_generate_v4()) returning uuid into nuuid; return nuuid; end; $$ language 'plpgsql';

with "select a_function()" in sql console, things going OK, but with pgmoon, i got no luck.

local res, err = pg_connect.query('select a_function()') res is empty "[{}]", err is null. nothing happened in postgres db.

was i using the wrong way to use pgmoon to call a function?

please help out.

thank you.

KSDaemon commented 5 years ago

@cqlangyi Try select * from a_function(). May be it can help

cqlangyi commented 5 years ago

@KSDaemon thank you! i tried, still got no luck. same result.

cqlangyi commented 5 years ago

turns out is a typo in my production function, there's nothing to do with pgmoon.

this issue now could be closed.

cheers.