2012-04-03 95 views
1

我的老板给我发了一个过程,而我需要:make_hash()函数?哈希码?

  • 做出从表
  • 创建临时表
  • 抓取数据的功能,使用功能完善的数据
  • 创建的哈希码的列的2
  • 从临时的所有数据插入到原始数据
  • 删除表

我一直在试图看看什么make_hash()函数。每当我运行功能它给了我该线路上的错误,所以我猜我需要先声明之前,在创建函数的开始声明。或者它是用户创建的功能?如果是这样,我有没有办法找到函数所在的模式?

我一直在努力研究的书籍和网上,但我无法找到任何东西,甚至在PostgreSQL的网站。

-------------------------------------------- 

ERROR: function make_hash(character varying) does not exist 
LINE 1: UPDATE temp_match_queue_04022012 SET title_hash = make_hash(... 
                 ^
HINT: No function matches the given name and argument types. You might need to add explicit type casts. 
QUERY: UPDATE temp_match_queue_04022012 SET title_hash = make_hash(as_title) WHERE as_title IS NOT NULL 
CONTEXT: PL/pgSQL function "metadata_matching_temp" line 30 at SQL statement 

********** Error ********** 

ERROR: function make_hash(character varying) does not exist 
SQL state: 42883 
Hint: No function matches the given name and argument types. You might need to add explicit type casts. 
Context: PL/pgSQL function "metadata_matching_temp" line 30 at SQL statement 
+2

添加您的代码和错误信息。 – barsju 2012-04-03 16:45:50

+0

已更新!对不起,但我之前发布的查询错误是另一个。 – 2012-04-03 17:16:30

+1

研究[pgcrypto](http://www.postgresql.org/docs/9.1/interactive/pgcrypto.html) – 2012-04-03 18:03:37

回答

1

由于@Clodoaldo提到直视pgcrypto(你会被它安装到你的Postgres得到,在Debian的PostgreSQL中-contrib请IIRC)。

调用任何功能必须是可用之前BEGIN部分。如果您需要多个功能,可以将功能组合到一起。

+0

我会注意到这一点。谢谢Angelo!我会阅读更多关于Clodoaldo发送给我的pgcrypto链接。 – 2012-04-03 21:20:10

+0

啊,你在开始部分之前有什么功能? – 2012-04-03 21:21:39

+0

@JohnV我的意思是,在你的代码被调用之前(它不是一个函数本身吗?我认为是这样),该函数必须已经被服务器知道。 – 2012-04-03 21:23:32

1

没关系! make_hash函数被写入psql,这就是为什么它不能正常工作。我正在使用pgAdmin III,并且模式名称必须与函数一起调用才能工作。非常感谢帮助!