在Postgres控制台(PSQL)中,我尝试编写一个简单的“批处理”测试:
\set oid
\set username 'john'
\set emailadr 'john@mailbox.net'
\set password 'jjjj'
INSERT INTO :oid SELECT auc_user_insert(:'username', :'emailadr', :'password');
SELECT auc_user_select(:oid);
SELECT auc_user_delete(:oid);
auc_user_insert
、auc_user_select
和 auc_user_delete
是与应用程序相关的Postgres函数,每个函数在查询工具内都能正常使用。
insert
函数返回 bigint 类型的唯一 id,我想将其分配给变量 oid
,以便在下一行中使用。
但是,在 PSQL 中使用 INTO :oid
语句时,我会收到错误提示。
ERROR: Relation 'bigint' doesn't exist
这个变量有什么问题,正确的使用方式是什么?感谢任何提示!