PostgreSQL中current_user和current_user()的区别
今天看到网上有人在问在POSTGRESQL 中Select current_user 可以执行成功,但是select current_user() 却会失败,这是为什么呢? 碰巧今天看到书上有一个小节,叫预定义变量的,里面列出了4 个。 aligputf8=# select current_date; date ------------ 2010-04-22 (1 row)
aligputf8=# select current_time; timetz -------------------- 17:47:53.066679+08 aligputf8=# select current_timestamp; now ------------------------------- 2010-04-22 17:47:59.626851+08 aligputf8=# select current_user; current_user -------------- etl (1 row) 下面加上括号试试 aligputf8=# select current_user(); ERROR: syntax error at or near "(" --报错了 没有这个函数 LINE 1: select current_user(); ^ aligputf8=# select now(); --这是个函数 2010-04-22 17:49:40.125055+08 (1 row)
aligputf8=# select now; --去掉括号就不行了 ERROR: column "now" does not exist LINE 1: select now; ^ 一类是函数,一类是预定义变量。个人理解哈。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |