[SQL] Problem in age on a dates interval

2004-07-16 Thread Luis Sousa
Hi all, I'm using PostgreSQL 7.3.3 on i386-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3 (Debian), and I don't understand the results of the following queries: SELECT age('2004-05-14 16:00'::timestamp,'2004-02-18 16:00'::timestamp); age 2 mons 25 days SELECT

Re: [SQL] Problem in age on a dates interval

2004-07-16 Thread Theodore Petrosky
Luis, wow at first I thought I had my head around a leap year problem so I advanced your query a year testbed=# SELECT age('2005-05-14 16:00'::timestamp,'2005-02-18 16:00'::timestamp); age 2 mons 24 days (1 row) testbed =# SELECT '2005-02-18

Re: [SQL] Problem in age on a dates interval

2004-07-16 Thread Tom Lane
Theodore Petrosky [EMAIL PROTECTED] writes: wow at first I thought I had my head around a leap year problem so I advanced your query a year I think what's going on here is a difference of interpretation about whether an M months D days interval means to add the months first or the days

[SQL] Sorting problem

2004-07-16 Thread Ruggero
Hi all, I have a problem sorting varchar fields. I will explain the problem with a simple example: this query select '##10' as sortfield union select '###1' as sortfield order by sortfield produces this correct output: '###1' '##10' but this one select

Re: [SQL] [PHP] Secure DB Systems - How to

2004-07-16 Thread Sarah Tanembaum
Thanks Bruno. I see the potential challenge. If the field value is encrypted, how can search be done for certain value? Do I have to seach for the encrypted value? If so, what password or key should I use? Thanks Bruno Wolff III [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On

Re: [SQL] Sorting problem

2004-07-16 Thread Stephan Szabo
On Mon, 12 Jul 2004, Ruggero wrote: Hi all, I have a problem sorting varchar fields. I will explain the problem with a simple example: this query select '##10' as sortfield union select '###1' as sortfield order by sortfield produces this correct output: '###1'

[SQL] Query plan discrepancies

2004-07-16 Thread Bob Arens
Hi, I have two databases that were created with identical schemas and both filled in the exact same way, with the same indices etc., yet they give different query paths for identical SELECTs. Normally this wouldn't bug me, but one DB returns the select in relatively short order, while the other

Re: [SQL] [ADMIN] [PHP] Secure DB Systems - How to

2004-07-16 Thread Mitch Pirtle
Daniel Struck wrote: If you decrypt the data on the database, the sysadmin can see it. Hm, you are right. If one does decrypt the data on the database you have to sent the password to postgresql and so a administrator of the database could easily grasb the password. So the only way to go,

Re: [SQL] Sorting problem

2004-07-16 Thread Stu
Pop text in front of that first value and it works: template1=# select text '##107990' template1=# as sortfield template1-# union template1-# select '###17990' template1-# order by sortfield; sortfield

[SQL] BYTEA output presentation

2004-07-16 Thread Peter Wang
I output the BYTEA datatype for a table in our database. The BYTEA data look like /031/024/001/003?/022/. How can I use some PostgreSQL function to remove / when I use select statement ? What type of format is the BYTEA datatype? Can I output it to hexadecimal or octal format ? If you can,

Re: [SQL] BYTEA output presentation

2004-07-16 Thread Peter Eisentraut
Peter Wang wrote: The BYTEA data look like /031/024/001/003?/022/. How can I use some PostgreSQL function to remove / when I use select statement ? What type of format is the BYTEA datatype? Can I output it to hexadecimal or octal format ? If you can, how ? Or do you know any third party

Re: [SQL] Query plan discrepancies

2004-07-16 Thread Rod Taylor
Have you run ANALYZE recently? Please send back EXPLAIN ANALYZE for the below query. EXPLAIN from DB 2 (doesn't come back): QUERY PLAN