Re: [GENERAL] Can a function return more then one table?

2012-01-10 Thread Mike Christensen
> 2012/1/11 Mike Christensen : >> I would like to write a function that returns one row from one table, >> and about 10 rows or so from another table.. >> >> Is there a clean way to do this, or am I better off making two separate >> queries? >> >> I'm thinking maybe I can use OUT parameters for th

Re: [GENERAL] Can a function return more then one table?

2012-01-10 Thread Pavel Stehule
Hello 2012/1/11 Mike Christensen : > I would like to write a function that returns one row from one table, > and about 10 rows or so from another table.. > > Is there a clean way to do this, or am I better off making two separate > queries? > > I'm thinking maybe I can use OUT parameters for the

[GENERAL] Can a function return more then one table?

2012-01-10 Thread Mike Christensen
I would like to write a function that returns one row from one table, and about 10 rows or so from another table.. Is there a clean way to do this, or am I better off making two separate queries? I'm thinking maybe I can use OUT parameters for the first table, and the return value for the second

[GENERAL] pgAdmin - Query - out of memory for query result

2012-01-10 Thread Kevin Duffy
Hello: I have run into a very frustrating problem. I have a database with some tables which were loaded from Excel spreadsheets via a Perl script. Guess that does not really matter. The table definitions are below. Both tables contain 9,398,340 rows On a machine running Windows 7 64Bit with

Re: [GENERAL] Extending the volume size of the data directory volume

2012-01-10 Thread panam
Hey, Got the problem again, this time, it is definitely not caused by changes to the filesystem. I think it is more likely because of postgres being run in a virtualized environment. This time, it hung some time after starting a manual analyze on the biggest table so far (55Gb, still growing). Now

Re: [GENERAL] Efficient map looking table

2012-01-10 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Yoann MOREAU Sent: Tuesday, January 10, 2012 4:45 PM To: pgsql-general@postgresql.org Subject: [GENERAL] Efficient map looking table Hello, I store in a database some XML-t

Re: [GENERAL] string = any()

2012-01-10 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Filip Rembialkowski Sent: Tuesday, January 10, 2012 4:27 PM To: Andy Colson Cc: PostgreSQL Subject: Re: [GENERAL] string = any() no, I meant array constructor with reserve

[GENERAL] Efficient map looking table

2012-01-10 Thread Yoann MOREAU
Hello, I store in a database some XML-tag data. I have one table for the tag names with an int PK for each unique name (tag_names) and one table for the tags (tags) where each row references a tag name. The tag_names table is not big but the tags table is huge. When I insert a row in tags

Re: [GENERAL] string = any()

2012-01-10 Thread Filip Rembiałkowski
W dniu 10 stycznia 2012 16:17 użytkownik Andy Colson napisał: >> 2012/1/10 Andy Colson: >>> I am writing PHP where it prepares a statement like: >>> $sql = 'select * from aTable where id = any($1)'; >>> >>> then in php I create a string: >>> $args = "{1,2,3}"; >>> >>> And run it: >>> >>> $q = pg_q

Re: [GENERAL] (check) constraints on composite type

2012-01-10 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Ralph Graulich Sent: Tuesday, January 10, 2012 3:47 PM To: David Johnston Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] (check) constraints on composite type Let's

Re: [GENERAL] (check) constraints on composite type

2012-01-10 Thread Ralph Graulich
Hi David! > Sorry for not answering the main question but you really need to avoid > phrases like "near future". That said, new features are only released > during major releases and so at best you would have to wait for 9.2 which is > probably 9+ months out since 9.1 was just recently released.

Re: [GENERAL] queries timeout during backup postgres database

2012-01-10 Thread Scott Marlowe
Did you connect as the backup user to the db and check what the statement_timeout is from that perspective? It's a locally settable var by db and by user, so it's still possible you'll get bit by this again if it's set for the backup user or just for that db. On Tue, Jan 10, 2012 at 1:13 PM, akp

Re: [GENERAL] (check) constraints on composite type

2012-01-10 Thread Merlin Moncure
On Tue, Jan 10, 2012 at 1:44 PM, David Johnston wrote: > Sorry for not answering the main question but you really need to avoid > phrases like "near future".  That said, new features are only released > during major releases and so at best you would have to wait for 9.2 which is > probably 9+ mont

Re: [GENERAL] string = any()

2012-01-10 Thread John R Pierce
On 01/10/12 8:18 AM, Andy Colson wrote: clayia=# select '{''joe'', ''bob'' }'; ?column? - {'joe', 'bob' } (1 row) It does return an array of string, or so it looks. I'm pretty sure that's just a string, not an array. -- john r pierceN 37, W 1

Re: [GENERAL] queries timeout during backup postgres database

2012-01-10 Thread akp geek
vacuum_cost_delay = 2ms , I set it as 20ms. last night I did not see any timeouts during the back up. But I don't understand that. Thanks a lot for the support On Mon, Jan 9, 2012 at 7:17 PM, Scott Marlowe wrote: > On Mon, Jan 9, 2012 at 1:06 PM, Scott Marlowe > wrote: > > On Mon, Jan 9, 2012 at

Re: [GENERAL] (check) constraints on composite type

2012-01-10 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Ralph Graulich Sent: Tuesday, January 10, 2012 2:30 PM To: pgsql-general@postgresql.org Subject: [GENERAL] (check) constraints on composite type Are there any plans to have

[GENERAL] (check) constraints on composite type

2012-01-10 Thread Ralph Graulich
Hi! As of PostgreSQL 9.1 it is not possible to declare check constraints on composite types, according to http://www.postgresql.org/docs/9.1/interactive/rowtypes.html. I cannot use domains in that particular context, because I want to have the check constraint check for a combination of fields

Re: [GENERAL] memory leak

2012-01-10 Thread Michael P. Soulier
On 10/01/12 Simon Riggs said: > You're missing 2 PQclear() calls on success. > > http://www.postgresql.org/docs/devel/static/libpq-exec.html#LIBPQ-EXEC-MAIN Ah, thanks. Diffing db.c to db.c@@/main/soulierm_MASTeleworker_dev1/3 --- db.c@@/main/soulierm_MASTeleworker_dev1/3 2011-08-10 07:09:27.

Re: [GENERAL] memory leak

2012-01-10 Thread Simon Riggs
On Tue, Jan 10, 2012 at 6:48 PM, Michael P. Soulier wrote: >    res = PQexec(conn, "BEGIN"); >    if (PQresultStatus(res) != PGRES_COMMAND_OK) >    { >        fprintf(stderr, "DB: BEGIN command failed: %s", PQerrorMessage(conn)); >        PQclear(res); >        exit_nicely(conn); >    } > >    re

[GENERAL] memory leak

2012-01-10 Thread Michael P. Soulier
Hi, I've written a small multi-threaded C program using libpq, and valgrind is reporting a memory leak. 2012-01-10 13:45:07.263078500 ==12695== 608 bytes in 4 blocks are definitely lost in loss record 19 of 22 2012-01-10 13:45:07.263097500 ==12695==at 0x4005B83: malloc (vg_replace_malloc.c:

Re: [GENERAL] How do you change the size of the WAL files?

2012-01-10 Thread Scott Marlowe
On Tue, Jan 10, 2012 at 8:56 AM, Ron Somaraju wrote: > David, thanks for the response. I appreciate it. I hope the community > understands the benefit of providing the functionality to be able to > dynamically increase WAL size without having to re-init the cluster (which I > think is the work

Re: [GENERAL] string = any()

2012-01-10 Thread Tom Lane
Andy Colson writes: > My confusion was from: > clayia=# select '{''joe'', ''bob'' }'; > ?column? > - > {'joe', 'bob' } > (1 row) > It does return an array of string, or so it looks. Yeah, it's not obvious that those quote marks are really data characters. I wonder whethe

Re: [GENERAL] How do you change the size of the WAL files?

2012-01-10 Thread Ron Somaraju
David, thanks for the response. I appreciate it. I hope the community understands the benefit of providing the functionality to be able to dynamically increase WAL size without having to re-init the cluster (which I think is the work around). In this information age an OLTP or OLAP database wit

Re: [GENERAL] string = any()

2012-01-10 Thread Andy Colson
On 1/10/2012 10:28 AM, David Johnston wrote: -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Andy Colson Sent: Tuesday, January 10, 2012 11:20 AM To: David Johnston Cc: 'PostgreSQL' Subject: Re: [GENERAL] string = any()

Re: [GENERAL] Two indexes on same column

2012-01-10 Thread Ernesto Quiñones
Hi, I was reading about indexes and I have a question: is possible to use "hash" like index method in primary key constraints?? thanks 2011/7/20 Raghavendra : > > On Wed, Jul 20, 2011 at 2:39 PM, Vlastimil Krejcir > wrote: >> >>  Hi, >> >>  what index is used (and according to what rules) when

Re: [GENERAL] string = any()

2012-01-10 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Andy Colson Sent: Tuesday, January 10, 2012 11:20 AM To: David Johnston Cc: 'PostgreSQL' Subject: Re: [GENERAL] string = any() > This still does not work, even in psql: > se

Re: [GENERAL] string = any()

2012-01-10 Thread Andy Colson
This still does not work, even in psql: select 'bob' = any( '{''joe'', ''bob'' }'::varchar[] ) $$ ^ This works for me just finethough I am not using psql; are you having quoting issues? What error do you get? It runs, but it returns false. I get false at least. I'm assuming you

Re: [GENERAL] string = any()

2012-01-10 Thread Andy Colson
On 1/10/2012 10:11 AM, Tom Lane wrote: Andy Colson writes: This still does not work, even in psql: select 'bob' = any( '{''joe'', ''bob'' }'::varchar[] ) You've got the array quoting rules wrong here (should be double quote marks, not single quotes). You didn't show us your PHP code but I su

Re: [GENERAL] string = any()

2012-01-10 Thread Tom Lane
Andy Colson writes: > This still does not work, even in psql: > select 'bob' = any( '{''joe'', ''bob'' }'::varchar[] ) You've got the array quoting rules wrong here (should be double quote marks, not single quotes). You didn't show us your PHP code but I surmise that's got the same mistake. Rea

Re: [GENERAL] string = any()

2012-01-10 Thread David Johnston
$$ My comments embedded below -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Andy Colson Sent: Tuesday, January 10, 2012 10:33 AM To: David Johnston Cc: 'PostgreSQL' Subject: Re: [GENERAL] string = any() On 1/10/2012 9:

Re: [GENERAL] How do you change the size of the WAL files?

2012-01-10 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Ron Somaraju Sent: Monday, January 09, 2012 8:21 PM To: Tom Lane Cc: Scott Marlowe; pgsql-general@postgresql.org Subject: Re: [GENERAL] How do you change the size of the WAL

Re: [GENERAL] string = any()

2012-01-10 Thread Andy Colson
On 1/10/2012 9:17 AM, David Johnston wrote: -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Andy Colson Sent: Tuesday, January 10, 2012 10:04 AM To: PostgreSQL Subject: [GENERAL] string = any() Hi all. I am writing PHP

Re: [GENERAL] string = any()

2012-01-10 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Andy Colson Sent: Tuesday, January 10, 2012 10:04 AM To: PostgreSQL Subject: [GENERAL] string = any() Hi all. I am writing PHP where it prepares a statement like: $sql = 's

Re: [GENERAL] string = any()

2012-01-10 Thread Andy Colson
2012/1/10 Andy Colson: Hi all. I am writing PHP where it prepares a statement like: $sql = 'select * from aTable where id = any($1)'; then in php I create a string: $args = "{1,2,3}"; And run it: $q = pg_query_params($db, $sql, $args); This is not actual code, just a sample. And it works g

Re: [GENERAL] string = any()

2012-01-10 Thread Filip Rembiałkowski
maybe try to use ARRAY constructor instead? http://www.postgresql.org/docs/9.0/static/sql-expressions.html#SQL-SYNTAX-ARRAY-CONSTRUCTORS 2012/1/10 Andy Colson : > Hi all. > > I am writing PHP where it prepares a statement like: > $sql = 'select * from aTable where id = any($1)'; > > then in php

[GENERAL] string = any()

2012-01-10 Thread Andy Colson
Hi all. I am writing PHP where it prepares a statement like: $sql = 'select * from aTable where id = any($1)'; then in php I create a string: $args = "{1,2,3}"; And run it: $q = pg_query_params($db, $sql, $args); This is not actual code, just a sample. And it works great for integers. I ca

Re: [GENERAL] Update takes longer than expected

2012-01-10 Thread Alban Hertroys
On 10 January 2012 15:46, Jerry Sievers wrote: >> We're trying to migrate the app from mysql to pg and this is one of >> the performance bottle-necks.  Unfortunately it slows down every >> request by about 5 seconds. That's a delay that could be due to DNS problems or other network issues. It may

Re: [GENERAL] Update takes longer than expected

2012-01-10 Thread Jerry Sievers
Andy Chambers writes: > Hi, > > I have an update that takes longer than expected and wondered if > there's an easy way to make it go faster. > > It's pretty simple:- > > create table session ( > id serial primary key, > data text); > > update session > set data = 'ipsum lorem...' > where

Re: [GENERAL] Mixed Pg-9.1.2 and 8.4.4 environment

2012-01-10 Thread Adrian Klaver
On Tuesday, January 10, 2012 6:17:27 am James B. Byrne wrote: > We are in the process of migrating our various servers to > a kvm host with guest vms. The new guests run pg-9.1.2 > under CentOS-6.2. However, our off site warm spares are > still running pg-8.4.4 under CentOS-5.7. > > We have an au

[GENERAL] Mixed Pg-9.1.2 and 8.4.4 environment

2012-01-10 Thread James B. Byrne
We are in the process of migrating our various servers to a kvm host with guest vms. The new guests run pg-9.1.2 under CentOS-6.2. However, our off site warm spares are still running pg-8.4.4 under CentOS-5.7. We have an automated transfer routine that dumps the live database, now running v.9.1.2

Re: [GENERAL] Time to move table to new tablespace

2012-01-10 Thread Craig Ringer
On 10/01/2012 3:10 AM, Jason Buberel wrote: "Select median price for every zip code as of 2012-01-06" (customer exports) "Select median price for 94086 from 2005-01-01 through 2012-01-06" (charting apps) So by partitioning in one dimension we impact queries in the other. Well, I know of *the

Re: [GENERAL] Side effects of moving an index to a new tablespace

2012-01-10 Thread Sergey Konoplev
2012/1/10 Ondrej Ivanič : >> One area where the documentation is not very detailed - What are the side >> effects and/or constraints put in place while an index is being moved? I >> assume that the index will not be available to the query planner/engine >> during that time period. Are there other w