[SQL] Encrytion in postgres field in table

2008-07-28 Thread Chris Preston
How do I setup a password table that I only want to encrypt 1 field
"password"



[SQL] Accessing array datatype

2008-07-28 Thread maria s
Hi All,
I have an array column in a table.
How can I fetch the elements separately( ie, select arr[1],arr[2]...arr[n])
as a column,
 when I don't know how many elements are there in the array?

Thanks for your help.

Maria


Re: [SQL] Accessing array datatype

2008-07-28 Thread Oliveiros Cristina
Maria,

You mean your array has a variable size, which you need to know in order to 
properly construct a query?

Dunno much about arrays, but here 
http://www.postgresql.org/docs/8.3/static/arrays.html is said that array_upper( 
your_array, 1 ) returns the upper bound of the array...

Can this be what you need...?


Best,
Oliveiros
  - Original Message - 
  From: maria s 
  To: Osvaldo Rosario Kussama ; pgsql-sql@postgresql.org ; Pavel Stehule ; Ivan 
Sergio Borgonovo 
  Sent: Monday, July 28, 2008 5:09 PM
  Subject: [SQL] Accessing array datatype


  Hi All,
  I have an array column in a table. 
  How can I fetch the elements separately( ie, select arr[1],arr[2]...arr[n]) 
as a column,
   when I don't know how many elements are there in the array?

  Thanks for your help.

  Maria

Re: [SQL] Accessing array datatype

2008-07-28 Thread Oliveiros Cristina
Maria,

Could you explain a little more the background?
What kind of output do you actually want?
.Do you need to retrieve all the arrays in that column in just one query?  
Or just need to get  one with a particular ID?

I learned bout the existence of arrays a few days ago :-) 
If I had this problem and with my current knowledge on arrays I would issue 
first one query to obtain the dimension and then programmatically I would build 
the next query with the exact number of columns (I use C# for client programs).
It would work fine if you are just hunting for a particular record on your 
table, but I don't know if that's your goal

Also, Please don't send private replies, always include the mailing list address
because someone with more knowledge than me might be able to quickly help you 
;-)

Best,
Oliveiros

  - Original Message - 
  From: maria s 
  To: Oliveiros Cristina 
  Sent: Monday, July 28, 2008 6:03 PM
  Subject: Re: [SQL] Accessing array datatype


  Hi Oliveiros,
  Thank you so much for your reply.
  I would like to get the elements of an array as columns instead of getting 
them as {a,b,..}

  May be if I know the array boundary, then I can fetch the elements as I wish.

  But I don't know is there any other way to get the data.

  Thank you for your reply.

  Maria


  On Mon, Jul 28, 2008 at 12:56 PM, Oliveiros Cristina <[EMAIL PROTECTED]> 
wrote:

Maria,

You mean your array has a variable size, which you need to know in order to 
properly construct a query?

Dunno much about arrays, but here 
http://www.postgresql.org/docs/8.3/static/arrays.html is said that array_upper( 
your_array, 1 ) returns the upper bound of the array...

Can this be what you need...?


Best,
Oliveiros
  - Original Message - 
  From: maria s 
  To: Osvaldo Rosario Kussama ; pgsql-sql@postgresql.org ; Pavel Stehule ; 
Ivan Sergio Borgonovo 
  Sent: Monday, July 28, 2008 5:09 PM
  Subject: [SQL] Accessing array datatype


  Hi All,
  I have an array column in a table. 
  How can I fetch the elements separately( ie, select 
arr[1],arr[2]...arr[n]) as a column,
   when I don't know how many elements are there in the array?

  Thanks for your help.

  Maria



Re: [SQL] Accessing array datatype

2008-07-28 Thread maria s
Hi Oliveiros,
Thanks for your reply and I am sorry I didn't notice that I missed pgsql
email id.

Yes, the solution that you stated is what I am going to do.
First query to  get the number of elements in the array, then fetch the
elements by building a query.
I am also using C# and I guess this may be the solution to my problem.

Thank you so much,

Maria


On Mon, Jul 28, 2008 at 1:21 PM, Oliveiros Cristina <
[EMAIL PROTECTED]> wrote:

>  Maria,
>
> Could you explain a little more the background?
> What kind of output do you actually want?
> .Do you need to retrieve all the arrays in that column in just one query?
> Or just need to get  one with a particular ID?
>
> I learned bout the existence of arrays a few days ago :-)
> If I had this problem and with my current knowledge on arrays I would issue
> first one query to obtain the dimension and then programmatically I would
> build the next query with the exact number of columns (I use C# for client
> programs).
> It would work fine if you are just hunting for a particular record on your
> table, but I don't know if that's your goal
>
> Also, Please don't send private replies, always include the mailing list
> address
> because someone with more knowledge than me might be able to quickly help
> you ;-)
>
> Best,
> Oliveiros
>
>
> - Original Message -
> *From:* maria s <[EMAIL PROTECTED]>
> *To:* Oliveiros Cristina <[EMAIL PROTECTED]>
> *Sent:* Monday, July 28, 2008 6:03 PM
> *Subject:* Re: [SQL] Accessing array datatype
>
> Hi Oliveiros,
> Thank you so much for your reply.
> I would like to get the elements of an array as columns instead of getting
> them as {a,b,..}
>
> May be if I know the array boundary, then I can fetch the elements as I
> wish.
>
> But I don't know is there any other way to get the data.
>
> Thank you for your reply.
>
> Maria
>
> On Mon, Jul 28, 2008 at 12:56 PM, Oliveiros Cristina <
> [EMAIL PROTECTED]> wrote:
>
>>  Maria,
>>
>> You mean your array has a variable size, which you need to know in order
>> to properly construct a query?
>>
>> Dunno much about arrays, but here
>> http://www.postgresql.org/docs/8.3/static/arrays.html is said that
>> array_upper( your_array, 1 ) returns the upper bound of the array...
>>
>> Can this be what you need...?
>>
>>
>> Best,
>> Oliveiros
>>
>> - Original Message -
>> *From:* maria s <[EMAIL PROTECTED]>
>> *To:* Osvaldo Rosario Kussama <[EMAIL PROTECTED]> ;
>> pgsql-sql@postgresql.org ; Pavel Stehule <[EMAIL PROTECTED]> ; Ivan
>> Sergio Borgonovo <[EMAIL PROTECTED]>
>> *Sent:* Monday, July 28, 2008 5:09 PM
>> *Subject:* [SQL] Accessing array datatype
>>
>> Hi All,
>> I have an array column in a table.
>> How can I fetch the elements separately( ie, select
>> arr[1],arr[2]...arr[n]) as a column,
>>  when I don't know how many elements are there in the array?
>>
>> Thanks for your help.
>>
>> Maria
>>
>>
>


Re: [SQL] Encrytion in postgres field in table

2008-07-28 Thread Andrej Ricnik-Bay
On 29/07/2008, Chris Preston <[EMAIL PROTECTED]> wrote:
> How do I setup a password table that I only want to encrypt 1 field
> "password"
http://www.postgresql.org/docs/8.3/interactive/pgcrypto.html




-- 
Please don't top post, and don't use HTML e-Mail :}  Make your quotes concise.

http://www.american.edu/econ/notes/htmlmail.htm

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] Query prepared plan

2008-07-28 Thread Emi Lu

Tom Lane wrote:

Emi Lu <[EMAIL PROTECTED]> writes:

Somebody know about how to find prepared query plan through command line?


PREPARE fooplan(...)
EXPLAIN EXECUTE fooplan(...)


Thank you Tom.

Similar to \dt to show all tables, within one session, may I know the 
command to list all prepared query plan please?


For example,
[1]\dX
   show all defined prepared query plan
[2]\dX planName
   show the definition of the named plan.

Thanks a lot!

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] PERSISTANT PREPARE (another point of view)

2008-07-28 Thread Milan Oparnica

chester c young wrote:


   Session #1 has search_path=schema1
   Session #2 has search_path=schema2
if session #1 attempts to exec stmt, it prepare and use schema1
if session #2 attempts to use stmt, if prepared globally, disaster



I'm sorry, I wasn't precise enough. When I said global I meant global in 
Schema scope. Just like standard stored procedures are.


Did you see post from Mr.Pavel.Stehule about PROCEDURES ?
Such implementation would have the same effect as global prepare.
If it could even support nesting (calling procedure from within another 
procedure).


Let's hope he does his implementation in 8.4.

Regards,

Milan Oparnica

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] Query prepared plan

2008-07-28 Thread Alvaro Herrera
Emi Lu wrote:

> Similar to \dt to show all tables, within one session, may I know the  
> command to list all prepared query plan please?

select * from pg_prepared_statements;

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] Encrytion in postgres field in table

2008-07-28 Thread Lennin Caro
use md5 function in a trigger when insert data

or see this link

http://www.postgresql.org/docs/8.3/static/pgcrypto.html


--- On Mon, 7/28/08, Chris Preston <[EMAIL PROTECTED]> wrote:

> From: Chris Preston <[EMAIL PROTECTED]>
> Subject: [SQL] Encrytion in postgres field in table
> To: pgsql-sql@postgresql.org
> Date: Monday, July 28, 2008, 1:25 PM
> How do I setup a password table that I only want to encrypt
> 1 field
> "password"


  


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql