473,399 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

md5 function

Hello,

Sorry for just stupid question, but I need use md5 function in 7.4
When I write:
select md5('text');
ERROR: Function md5("unknown") does not exist
Unable to identify a function that satisfies the given argument types
You may need to add explicit typecasts

where is problem???

thanx, miso
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #1
7 11183
On Wed, Dec 17, 2003 at 09:47:01AM +0100, Miso Hlavac wrote:
Sorry for just stupid question, but I need use md5 function in 7.4
When I write:
select md5('text');
ERROR: Function md5("unknown") does not exist
Unable to identify a function that satisfies the given argument types
You may need to add explicit typecasts

where is problem???


Are you sure the server is 7.4? What does SELECT VERSION() show?

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #2
On Wednesday 17 December 2003 08:47, Miso Hlavac wrote:
Hello,

Sorry for just stupid question, but I need use md5 function in 7.4
When I write:
select md5('text');
ERROR: Function md5("unknown") does not exist
Unable to identify a function that satisfies the given argument
types You may need to add explicit typecasts


Have a look in the contrib/crypto add-on, I think md5() is in there.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #3
On Wed, Dec 17, 2003 at 09:37:07AM +0000, Richard Huxton wrote:
On Wednesday 17 December 2003 08:47, Miso Hlavac wrote:
Hello,

Sorry for just stupid question, but I need use md5 function in 7.4
When I write:
select md5('text');
ERROR: Function md5("unknown") does not exist
Unable to identify a function that satisfies the given argument
types You may need to add explicit typecasts


Have a look in the contrib/crypto add-on, I think md5() is in there.


md5() should be stock in 7.4.

mydb=> \x
Expanded display is on.
mydb=> \df+ md5
List of functions
-[ RECORD 1 ]-------+--------------------
Result data type | text
Schema | pg_catalog
Name | md5
Argument data types | text
Owner | pgsql
Language | internal
Source code | md5_text
Description | calculates md5 hash

The internal function md5_text() is in src/backend/utils/adt/varlena.c.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #4
Miso Hlavac wrote:
Hello,

Sorry for just stupid question, but I need use md5 function in 7.4
When I write:
select md5('text');
ERROR: Function md5("unknown") does not exist
Unable to identify a function that satisfies the given argument types
You may need to add explicit typecasts

where is problem???


I'm using 7.4 and it's working.
$ psql
Welcome to psql 7.4, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

db=# select md5('test');
md5
----------------------------------
098f6bcd4621d373cade4e832627b4f6
(1 row)

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #5
On Wed, 17 Dec 2003, Michael Fuhr wrote:
md5() should be stock in 7.4.


Is there a way to, when I add a record to a table, have the md5 hash
computed and stored in the same table and then returned to the calling
program? Currently, I'm using the perl md5 function to compute the hash
and store it in the DB but I'm thinking that offloading this to the DB
itself might be faster (of course, if that's not true and the way I'm
doing things now is fine, then I'll leave it as it is).

--
Jon Earle

SAVE FARSCAPE http://www.savefarscape.com/

Vegetarian - an old Indian word meaning 'lousy hunter'.

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #6
Jon Earle <je******@kronos.honk.org> writes:
Is there a way to, when I add a record to a table, have the md5 hash
computed and stored in the same table and then returned to the calling
program? Currently, I'm using the perl md5 function to compute the hash
and store it in the DB but I'm thinking that offloading this to the DB
itself might be faster (of course, if that's not true and the way I'm
doing things now is fine, then I'll leave it as it is).


If your webserver is heavily loaded and the DB server isn't too busy,
this might be a win; otherwise it's unlikely to make any difference.
I think perl calls out to C to do the md5 computation, so it's just as
fast as the version in Postgres.

That said, the way to do it if you wanted to would be to write an
insert_my_record() function that stores the data for the record and
returns the md5 hash.

-Doug

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #7
On Wed, 2003-12-17 at 06:30, Jon Earle wrote:
Is there a way to, when I add a record to a table, have the md5 hash
computed and stored in the same table and then returned to the calling
program?

I recommend that you write a trigger to compute the md5 and shove that
into a column. There are several integrity advantages of having
postgresql do it in a trigger: 1) you can guarantee that it gets done,
2) you don't have to worry about a clients lying about the md5 or
computing the md5 in different ways, 3) the md5 gets computed regardless
of how the record is inserted, and 4) you can attach the trigger to
updates as well.

As for returning the md5 to the caller/client, that's probably best done
with a function whose job is to insert a record and return the md5. I
have functions like serial# <- ins_record(datum,datum,datum), which
merely do an insert into table and return the serial number for that
record.

-Reece
--
Reece Hart, Ph.D. rk*@gene.com, http://www.gene.com/
Genentech, Inc. 650/225-6133 (voice), -5389 (fax)
Bioinformatics and Protein Engineering
1 DNA Way, MS-93 http://www.in-machina.com/~reece/
South San Francisco, CA 94080-4990 re***@in-machina.com, GPG: 0x25EC91A0

Nov 12 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
5
by: phil_gg04 | last post by:
Dear Javascript Experts, Opera seems to have different ideas about the visibility of Javascript functions than other browsers. For example, if I have this code: if (1==2) { function...
2
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would...
2
by: sushil | last post by:
+1 #include<stdio.h> +2 #include <stdlib.h> +3 typedef struct +4 { +5 unsigned int PID; +6 unsigned int CID; +7 } T_ID; +8 +9 typedef unsigned int (*T_HANDLER)(void); +10
8
by: Olov Johansson | last post by:
I just found out that JavaScript 1.5 (I tested this with Firefox 1.0.7 and Konqueror 3.5) has support not only for standard function definitions, function expressions (lambdas) and Function...
3
by: Beta What | last post by:
Hello, I have a question about casting a function pointer. Say I want to make a generic module (say some ADT implementation) that requires a function pointer from the 'actual/other modules'...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
28
by: Larax | last post by:
Best explanation of my question will be an example, look below at this simple function: function SetEventHandler(element) { // some operations on element element.onclick = function(event) {
4
by: alex | last post by:
I am so confused with these three concept,who can explained it?thanks so much? e.g. var f= new Function("x", "y", "return x * y"); function f(x,y){ return x*y } var f=function(x,y){
7
by: VK | last post by:
I was getting this effect N times but each time I was in rush to just make it work, and later I coudn't recall anymore what was the original state I was working around. This time I nailed the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.