[GENERAL] ¿Cómo comparar el resultado de dos consultas?

2013-09-16 Thread Juan Daniel Santana Rodés
Buenas... Estoy desarrollando una tarea en la cual necesito saber cómo comparar el resultado de dos consultas... He pensado en crear un procedimiento el cual reciba por parámetros ambas consultas respectivamente. Luego de alguna forma poder ejecutar las consultas y devolver si ambas tienen el m

Re: [GENERAL] using Replace funcion in postgresql

2013-09-16 Thread David Johnston
karinos57 wrote > SELECT >Volume, REPLACE(Volume,'.','') > FROM MyTable > > The data in my table looks like this: > > 88.97 > 448.58 and etc > > i want to show like this with out the period: > > 8897 > 44858 > > I have tried to use different ways but still getting the error i ho

Re: [GENERAL] Why does this array query fail?

2013-09-16 Thread David Johnston
Ken Tanzer wrote > Well I partially take back my last question. In the error message, I > missed the non-array / array part of "integer = text[]" > > But I'm still confused. My subselect returns an array. If I cast it to a > text array, ANY is happy. But if I don't do so, what exactly does > P

Re: [GENERAL] Why does this array query fail?

2013-09-16 Thread Ken Tanzer
Well I partially take back my last question. In the error message, I missed the non-array / array part of "integer = text[]" But I'm still confused. My subselect returns an array. If I cast it to a text array, ANY is happy. But if I don't do so, what exactly does Postgres think my subquery has

Re: [GENERAL] Why does this array query fail?

2013-09-16 Thread Ken Tanzer
OK I tried that and see it works with the cast. But now I'm confused about both what exactly is failing without the cast, and about the resulting error message. Is the query failing because PG doesn't understand the subquery is yielding an array? Seems unlikely. But if the problem is a type mis

Re: [GENERAL] Why does this array query fail?

2013-09-16 Thread bricklen
On Mon, Sep 16, 2013 at 6:36 PM, Ken Tanzer wrote: > Thanks for the explanation. I think I at least understand what it's doing > now. I'm either surprised or confused though, as I was under the > impression that you could substitute a subquery for a value pretty much > anywhere, but I guess tha

Re: [GENERAL] Why does this array query fail?

2013-09-16 Thread Ken Tanzer
Thanks for the explanation. I think I at least understand what it's doing now. I'm either surprised or confused though, as I was under the impression that you could substitute a subquery for a value pretty much anywhere, but I guess that's not the case? Cheers, Ken On Mon, Sep 16, 2013 at 6:16

Re: [GENERAL] using Replace funcion in postgresql

2013-09-16 Thread Adrian Klaver
On 09/16/2013 04:55 PM, karinos57 wrote: SELECT Volume, REPLACE(Volume,'.','') FROM MyTable The data in my table looks like this: 88.97 448.58 and etc i want to show like this with out the period: 8897 44858 I have tried to use different ways but still getting the error i hope

Re: [GENERAL] Why does this array query fail?

2013-09-16 Thread David Johnston
Ken Tanzer wrote > ets_reach=> SELECT 'found' WHERE 'test' = ANY( (SELECT > ARRAY['test','pass','fail']) ); > > ERROR: array value must start with "{" or dimension information > LINE 1: SELECT 'found' WHERE 'test' = ANY( (SELECT ARRAY['test','pas... > ^ Per documenta

Re: [GENERAL] using Replace funcion in postgresql

2013-09-16 Thread John R Pierce
On 9/16/2013 4:55 PM, karinos57 wrote: SELECT Volume, REPLACE(Volume,'.','') FROM MyTable The data in my table looks like this: 88.97 448.58 and etc i want to show like this with out the period: 8897 44858 I have tried to use different ways but still getting the error i hope

Re: [GENERAL] Why does this array query fail?

2013-09-16 Thread bricklen
On Mon, Sep 16, 2013 at 5:32 PM, Ken Tanzer wrote: > SELECT 'found' WHERE 'test' = ANY( (SELECT ARRAY['test','pass','fail']) ); > It works if you drop the inner SELECT. SELECT 'found' WHERE 'test' = ANY( ARRAY['test','pass','fail'] );

[GENERAL] using Replace funcion in postgresql

2013-09-16 Thread karinos57
SELECT Volume, REPLACE(Volume,'.','') FROM MyTable The data in my table looks like this: 88.97 448.58 and etc i want to show like this with out the period: 8897 44858 I have tried to use different ways but still getting the error i hope someone out there can help me. How can i ac

[GENERAL] Why does this array query fail?

2013-09-16 Thread Ken Tanzer
Hi. Can someone explain to me why the last query below is failing, or what exactly the error message means? I'm sure there's a simple reason, but I'm totally not seeing it. I boiled this down from a more complicated example, but I think the problem is the same. Thanks in advance. Ken ets_reac

Re: [GENERAL] Postgres 9.2.4 "Double Precision" Precision

2013-09-16 Thread NWRFC Portland
Adrian, Kevin, Thank you for the clues. It turns out a java process was added (between the data source and database) at same time of postgres upgrade. It was the java process that incorrectly handled the double precision data. Joanne On Sat, Sep 14, 2013 at 9:57 AM, Adrian Klaver wrote: > On

Re: [GENERAL] Segmentation fault: pg_upgrade 9.1 to 9.3: pg_dump: row number 0 is out of range 0..-1

2013-09-16 Thread Jeff Janes
On Sun, Sep 15, 2013 at 8:02 PM, Robert Nix wrote: > If you do the dump using 9.1's pg_dump without --binary-upgrade, and then >> load that dump file into a new empty 9.1 server, then does it crash if you >> take a dump against *that* server? >> > > I'll give it a try. > > If so, would you be all

Re: [GENERAL] [PG9.1] CTE usage

2013-09-16 Thread David Johnston
Ladislav Lenart wrote > Hello all. > > I am curious about the following usage of CTEs: > > Imagine three tables: > * item (id, item_type1_id, item_type2_id, ...) > * item_type1 (id, ...) > * item_type2 (id, ...) > where > * item_type1_id is FK to item_type1 (id) > * item_type2_id is FK to it

Re: [GENERAL] [PG9.1] CTE usage

2013-09-16 Thread Vincent Veyron
Le lundi 16 septembre 2013 à 08:30 -0700, David Johnston a écrit : > Ladislav Lenart wrote > > Hello all. > > > > I am curious about the following usage of CTEs: > > > > Imagine three tables: > > * item (id, item_type1_id, item_type2_id, ...) > > * item_type1 (id, ...) > > * item_type2 (id, ..

Re: [GENERAL] [PG9.1] CTE usage

2013-09-16 Thread Ladislav Lenart
On 16.9.2013 17:30, David Johnston wrote: > Ladislav Lenart wrote >> Hello all. >> >> I am curious about the following usage of CTEs: >> >> Imagine three tables: >> * item (id, item_type1_id, item_type2_id, ...) >> * item_type1 (id, ...) >> * item_type2 (id, ...) >> where >> * item_type1_id is

Re: [GENERAL] Best way to populate nested composite type from JSON`

2013-09-16 Thread Merlin Moncure
On Fri, Sep 13, 2013 at 7:52 PM, Chris Travers wrote: > On Fri, Sep 13, 2013 at 8:51 AM, Merlin Moncure wrote: >> What's your client side stack? >> >> merlin > > > Right now we are using something a little lighter weight in terms db > discovery but it doesn't handle this situation very well. I a

Re: [GENERAL] [PG9.1] CTE usage

2013-09-16 Thread Ladislav Lenart
On 16.9.2013 17:12, Adrian Klaver wrote: > On 09/16/2013 07:38 AM, Ladislav Lenart wrote: >> On 16.9.2013 15:50, Adrian Klaver wrote: >>> On 09/16/2013 04:57 AM, Ladislav Lenart wrote: On 16.9.2013 13:26, Alban Hertroys wrote: >>> > >>> .." >> >> >> Hello. >> >> Thank you but I have read this

Re: [GENERAL] [PG9.1] CTE usage

2013-09-16 Thread Adrian Klaver
On 09/16/2013 07:38 AM, Ladislav Lenart wrote: On 16.9.2013 15:50, Adrian Klaver wrote: On 09/16/2013 04:57 AM, Ladislav Lenart wrote: On 16.9.2013 13:26, Alban Hertroys wrote: .." Hello. Thank you but I have read this in the official documentation before posting my (previous) reply. S

Re: [GENERAL] [PG9.1] CTE usage

2013-09-16 Thread Ladislav Lenart
On 16.9.2013 15:50, Adrian Klaver wrote: > On 09/16/2013 04:57 AM, Ladislav Lenart wrote: >> On 16.9.2013 13:26, Alban Hertroys wrote: > >>> >>> Wouldn't it be much easier to define an FK constraint with ON DELETE >>> CASCADE? >>> With that, you only need to worry about which rows you delete from

Re: [GENERAL] [PG9.1] CTE usage

2013-09-16 Thread Adrian Klaver
On 09/16/2013 04:57 AM, Ladislav Lenart wrote: On 16.9.2013 13:26, Alban Hertroys wrote: Wouldn't it be much easier to define an FK constraint with ON DELETE CASCADE? With that, you only need to worry about which rows you delete from the parent table and dependant children will be removed aut

Re: [GENERAL] [PG9.1] CTE usage

2013-09-16 Thread Ladislav Lenart
Nevermind, I already found the root cause of my problem: boolean logic of NULL in conjunction with the NOT IN operator. My real usecase was a bit more involved: WITH items_to_delete AS ( SELECT item.id AS item_id, item.item_type1_id AS item_type1_id, item.item_type2_id

Re: [GENERAL] [PG9.1] CTE usage

2013-09-16 Thread Ladislav Lenart
On 16.9.2013 13:26, Alban Hertroys wrote: > On 16 September 2013 11:58, Ladislav Lenart wrote: >> Hello all. >> >> I am curious about the following usage of CTEs: >> >> Imagine three tables: >> * item (id, item_type1_id, item_type2_id, ...) >> * item_type1 (id, ...) >> * item_type2 (id, ...) >>

Re: [GENERAL] [PG9.1] CTE usage

2013-09-16 Thread Alban Hertroys
On 16 September 2013 11:58, Ladislav Lenart wrote: > Hello all. > > I am curious about the following usage of CTEs: > > Imagine three tables: > * item (id, item_type1_id, item_type2_id, ...) > * item_type1 (id, ...) > * item_type2 (id, ...) > where > * item_type1_id is FK to item_type1 (id) >

[GENERAL] [PG9.1] CTE usage

2013-09-16 Thread Ladislav Lenart
Hello all. I am curious about the following usage of CTEs: Imagine three tables: * item (id, item_type1_id, item_type2_id, ...) * item_type1 (id, ...) * item_type2 (id, ...) where * item_type1_id is FK to item_type1 (id) * item_type2_id is FK to item_type2 (id) Items are of two types (type1

Re: [GENERAL] hot_standby_feedback

2013-09-16 Thread Stuart Bishop
On Thu, Aug 29, 2013 at 2:44 PM, Tatsuo Ishii wrote: > I have a question about hot_standby_feedback parameter. In my > understanding, if this parameter is on, a long running transaction on > standby will not be canceled even if the transaction conflicts. > As you can see vacuum on the primary rem

Re: [GENERAL] Rename extension?

2013-09-16 Thread Albe Laurenz
Moshe Jacobson wrote: > Is there a way to rename an installed extension? > > I have written an extension, but I don't like the name I originally chose, > and I would therefore like > to rename it. However, it is installed on a production system, from which it > cannot be uninstalled, > and I wou