Postgres:错误:准备好的声明" add_post"不存在

时间:2018-01-11 20:32:31

标签: postgresql

我可能不会直视并遗漏一些明显的东西,但为什么以下准备好的陈述没有被执行?

CREATE OR REPLACE FUNCTION add_post (userId BIGINT, fbUserId CHARACTER VARYING(128), fbUserName CHARACTER VARYING(250), gender GENDER, 
                googlePlaceId CHARACTER VARYING, googlePlaceName CHARACTER VARYING(250),
                geom geometry(Point,4326), statusText TEXT, statusImg TEXT)
    RETURNS void AS $$
    BEGIN
    INSERT INTO "post"."post"(user_id, fb_user_id, fb_user_name, gender, google_place_id, google_place_name, geom, posttype_id, status_text, status_img) 
    VALUES (userId, fbUserId, fbUserId, gender, googlePlaceId, googlePlaceName, geom, (SELECT posttype_id FROM "post"."posttype" WHERE code = 'LIVE'), statusText, statusImg);
    END;
    $$ LANGUAGE plpgsql;

EXECUTE add_post(1, '001', 'Thomas Cop', 'm', '4f89212bf76dde31f092cfc14d7506555d85b5c7', 'Hard Rock Cafe', ST_SetSRID(ST_MakePoint(4.35292, 50.84618), 4326),
    'Status text 1 Tomas Cop', '/img/001.png');

收到的错误是:

ERROR:  prepared statement "add_post" does not exist

我在pgadmin控制台中执行此操作。

1 个答案:

答案 0 :(得分:0)

your_application.exe.config用于准备语句,请查看示例https://www.postgresql.org/docs/9.1/static/sql-prepare.html#SQL-PREPARE-EXAMPLES

如果你想执行一项功能

EXECUTE