[HACKERS] Functions + plpgsql + contrib/pgcrypto = ??

2005-03-24 Thread Moran.Michael
Hello there, What's the preferred and most efficient way to obtain PGCrypto encrypted data from a plpgsql function? 1. Imagine the following simple table: CREATE TABLE crypto ( pid SERIAL PRIMARY KEY, title VARCHAR(50), crypted_content BYTEA ); 2. Now insert the following 3

[HACKERS] Calling Functions from Delete Rule (+ contrib/pgcrypto) = madness ??

2005-03-24 Thread Moran.Michael
Hello there, I have a View with a Delete rule and I would like the Delete rule to call a function (and pass-in a few of the the underlying View's/Table's column values). How do you do this? When I do it, I keep getting the following error: ERROR: function expression in FROM may not refer to

[HACKERS] contrib/pgcrypto

2005-03-16 Thread Moran.Michael
Hello, How do you encrypt() decrypt() data of types INT4 or DATE? The PGCrypto methods encrypt() and decrypt() each take BYTEA as input: i.e., encrypt( data::bytea, key::bytea, type::text) decrypt( data::bytea, key::bytea, type::text) So how do you convert INT4 and DATE data into

[HACKERS] How to cast VARCHAR to BYTEA and vice-versa?

2005-03-08 Thread Moran.Michael
Hello all, I have a table with a VARCHAR column that I need to convert to a BYTEA. How do I cast VARCHAR to BYTEA? The following doesn't seem to work as it yields the 'cannot cast varchar to bytea' error message: varchar_data::bytea On the same topic, how do I do the reverse, that

Re: [HACKERS] How to cast VARCHAR to BYTEA and vice-versa?

2005-03-08 Thread Moran.Michael
to use plpgsql in a Function (a.k.a. stored procedure)? Is there no simple cast or conversion method I can call that does this for me? Best Regards, Michael Moran _ From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Tue 3/8/2005 9:18 AM To: Moran.Michael Cc: pgsql-hackers@postgresql.org