EnterpriseDB PostgreSQL 中没有 getdate() 函数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2880683/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
No getdate() function in EnterpriseDB PostgreSQL
提问by Suezy
Do you have any idea on how to have a getdate()
function in EnterpriseDB PostgreSQL? I upgraded to EDB-PSQL, and when I try to restore old data from the free PSQL, it returns error on some tables since there is no getdate()
.
您知道如何getdate()
在 EnterpriseDB PostgreSQL 中使用函数吗?我升级到 EDB-PSQL,当我尝试从免费 PSQL 恢复旧数据时,它在某些表上返回错误,因为没有getdate()
.
I believe this should automatically be created upon creating new database? But it didn't. :( Only a now()
function.
我相信这应该在创建新数据库时自动创建?但它没有。:( 只有一个now()
功能。
Can I create the function instead? Help!
我可以创建函数吗?帮助!
回答by araqnid
If getdate()
is like now()
(as with SQL Server) you can simply say
如果getdate()
就像now()
(与 SQL Server 一样),您可以简单地说
create function public.getdate() returns timestamptz
stable language sql as 'select now()';