[GENERAL] RETURNING MORE THAN ONE CUSTOM TYPE FROM FUNCTION

2012-06-13 Thread utsav
I am doing Oracle to PostgreSQL migration activity as part of Procedure Migration in Oracle there are *OUT parameters which return records(using bulk collect) of custom type.* *like function returing type1,type2. * What will be alternative for PostgreSQL to do this. *There are OUT parameters in

[GENERAL] Is there a way to ask PostgreSQL for the name of the computer it's running on?

2012-06-13 Thread Rob Richardson
My customer has 3 computers. The PostgreSQL service could be running on either of two of them. There is currently no way in our system to determine which one it is running on. The third computer sometimes needs to know which of the other two computers is active. It would be enough to know wh

Re: [GENERAL] pg_upgrade: "pg_ctl failed to start the new server"

2012-06-13 Thread Bruce Momjian
On Wed, Jun 13, 2012 at 10:41:37PM -0400, Evan D. Hoffman wrote: > Actually I found the solution right after I sent that email (of > course): > > https://wiki-bsse.ethz.ch/download/attachments/55283107/PostgreSQL_9_M > aintenance_Backup_and_Recovery_final.docx > > Has to do with the order in which

[GENERAL] Azure?

2012-06-13 Thread Craig Ringer
Hi all I was at a Microsoft Azure event yesterday (hey, don't blame me, the beer was on Microsoft) and was surprised by how open Azure appears to be. Given the reports of unsatisfactory to miserable performance I see here from people running Pg on EC2, I'm curious about whether anyone's fired

Re: [GENERAL] pg_upgrade: "pg_ctl failed to start the new server"

2012-06-13 Thread Bruce Momjian
On Wed, Jun 13, 2012 at 11:19:41AM -0400, Evan D. Hoffman wrote: > I'm trying to upgrade Postgres 9.0 to 9.1 with pg_upgrade. Both > versions are installed from the PGDG Yum repo: > > -bash-4.1$ /usr/pgsql-9.0/bin/postgres -V > postgres (PostgreSQL) 9.0.8 > -bash-4.1$ /usr/pgsql-9.1/bin/postgres

Re: [GENERAL] import *.backup-file (PostGIS - not mine)

2012-06-13 Thread gipsy-king1
I think my postgis is installed because of these three following reasons - but I am not 100% sure. 1) With pgAdmin I created a database. The template I took was the "template_postgis" 2) When I open the Application Stack Builder an get the list of all possible applications to install - under "Spa

Re: [GENERAL] Recovery continually requests new WAL files

2012-06-13 Thread Alex Good
On 13/06/12 09:10, Albe Laurenz wrote: Alex Good wrote: I have a simple setup with one master and one backup server. I have an issue where I have performed a backup and copied it to the data directory for the slave, written a recovery.conf and copied in the backup_label file and then started the

[GENERAL] pg_upgrade: "pg_ctl failed to start the new server"

2012-06-13 Thread Evan D. Hoffman
I'm trying to upgrade Postgres 9.0 to 9.1 with pg_upgrade. Both versions are installed from the PGDG Yum repo: -bash-4.1$ /usr/pgsql-9.0/bin/postgres -V postgres (PostgreSQL) 9.0.8 -bash-4.1$ /usr/pgsql-9.1/bin/postgres -V postgres (PostgreSQL) 9.1.4 I can successfully start and connect to both

Re: [GENERAL] Passing master tag around in a multi-site master-slave system

2012-06-13 Thread John R Pierce
On 06/13/12 3:25 PM, Gauthier, Dave wrote: One master, 4 slaves. Can only write to the master (over WAN). No write transaction can be committed until it's duplicated at all the slave sites. (this, so far, is I think a standard requirement/request). Now, the "master" token can get passed fro

[GENERAL] Passing master tag around in a multi-site master-slave system

2012-06-13 Thread Gauthier, Dave
Here's the problem... Five sites, one DB, all 5 sites have read/write to the DB. If one site goes down, the other 4 should be able to continue to work with the DB (read and write). When the dead site comes back on line, it ought to be able to rejoin the group. If one site become isolated (n

Re: [GENERAL] ctid ranges

2012-06-13 Thread Tom Lane
Bruce Momjian writes: > On Wed, Jun 13, 2012 at 03:21:17PM -0500, Merlin Moncure wrote: >> IMNSHO, it's a no-brainer for the todo (but I think it's more >> complicated than adding some comparisons -- which are working now): > I see. Seems we have to add index smarts to those comparisons. That >

[GENERAL] composite type use in pl/gpsql

2012-06-13 Thread Little, Douglas
Merlin writes" first, the way to do insert from composite type is like this: insert into foo select (f).*; if f is type of foo. The actual error you're getting is probably" I gave this a try. Still bumping into syntax errors CREATE TYPE oww_mart_tbls.type_log_site_process AS (proc_id i

Re: [GENERAL] ctid ranges

2012-06-13 Thread Bruce Momjian
On Wed, Jun 13, 2012 at 03:21:17PM -0500, Merlin Moncure wrote: > On Wed, Jun 13, 2012 at 3:18 PM, Bruce Momjian wrote: > > On Wed, Jun 13, 2012 at 03:15:14PM -0500, Merlin Moncure wrote: > >> yeah -- and I think it's a great thing to want to be able to do.  it > >> could be used in parallelizing

Re: [GENERAL] ctid ranges

2012-06-13 Thread Merlin Moncure
On Wed, Jun 13, 2012 at 3:18 PM, Bruce Momjian wrote: > On Wed, Jun 13, 2012 at 03:15:14PM -0500, Merlin Moncure wrote: >> yeah -- and I think it's a great thing to want to be able to do.  it >> could be used in parallelizing tricks for example: divide up a table >> into N approximately equal part

Re: [GENERAL] ctid ranges

2012-06-13 Thread Bruce Momjian
On Wed, Jun 13, 2012 at 03:15:14PM -0500, Merlin Moncure wrote: > On Mon, Jun 11, 2012 at 7:57 PM, Jeff Davis wrote: > > On Fri, 2012-06-08 at 22:27 +0100, Thomas Munro wrote: > >> This is slow, handled with a seq scan (as are various rephrasing with > >> <, <=, etc): > >> > >> SELECT ... FROM ...

Re: [GENERAL] ctid ranges

2012-06-13 Thread Merlin Moncure
On Mon, Jun 11, 2012 at 7:57 PM, Jeff Davis wrote: > On Fri, 2012-06-08 at 22:27 +0100, Thomas Munro wrote: >> This is slow, handled with a seq scan (as are various rephrasing with >> <, <=, etc): >> >> SELECT ... FROM ... WHERE ctid BETWEEN ... AND ...; >> >> Is there a way to retrieve the rows i

Re: [GENERAL] composite type use in pl/gpsql

2012-06-13 Thread Merlin Moncure
On Wed, Jun 13, 2012 at 12:25 PM, Little, Douglas wrote: > Hello, > > Thanks in advance for taking my question. > > Running on Greenplum 4.1.2/ based on PG 8.2.3 kernal > > > > We make extensive use of functions to do our ETL. > > So, I’m building a stored procedure template for our developers. >

Re: [GENERAL] Problem with pg_upgrade 8.3 to 9.1.4 - clog missing?!

2012-06-13 Thread hubert depesz lubaczewski
On Wed, Jun 13, 2012 at 02:55:41PM -0400, Bruce Momjian wrote: > On Wed, Jun 13, 2012 at 08:43:23PM +0200, hubert depesz lubaczewski wrote: > > On Wed, Jun 13, 2012 at 02:32:21PM -0400, Bruce Momjian wrote: > > > I assume 8.3 vacuumdb did not generate these errors. If it was 8.4 I > > > would sugg

Re: [GENERAL] Problem with pg_upgrade 8.3 to 9.1.4 - clog missing?!

2012-06-13 Thread Bruce Momjian
On Wed, Jun 13, 2012 at 08:43:23PM +0200, hubert depesz lubaczewski wrote: > On Wed, Jun 13, 2012 at 02:32:21PM -0400, Bruce Momjian wrote: > > I assume 8.3 vacuumdb did not generate these errors. If it was 8.4 I > > would suggest it was because we don't copy visibility map files from > > pre-9.1

Re: [GENERAL] Problem with pg_upgrade 8.3 to 9.1.4 - clog missing?!

2012-06-13 Thread hubert depesz lubaczewski
On Wed, Jun 13, 2012 at 02:32:21PM -0400, Bruce Momjian wrote: > I assume 8.3 vacuumdb did not generate these errors. If it was 8.4 I > would suggest it was because we don't copy visibility map files from > pre-9.1 because those were not crash-safe, but 8.3 didn't have > visibility map files (adde

Re: [GENERAL] Problem with pg_upgrade 8.3 to 9.1.4 - clog missing?!

2012-06-13 Thread Bruce Momjian
On Thu, Jun 07, 2012 at 09:16:49PM +0200, hubert depesz lubaczewski wrote: > hi > I just upgraded test copy of database of our customer (~ 600GB of data). > upgrade went fine, no errors. but vacuumdb -azv ended with an error: > > => vacuumdb --all --analyze -p 6665 > vacuumdb: vacuuming database "

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Merlin Moncure
On Wed, Jun 13, 2012 at 12:25 PM, Tom Lane wrote: > Merlin Moncure writes: >> The CREATE VIEW statement does not allow parameterized arguments >> apparently. > > Well, no.  What would it mean?  The view is likely to outlast the > existence of the function argument. right -- it's quite sensible e

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Tom Lane
Merlin Moncure writes: > The CREATE VIEW statement does not allow parameterized arguments > apparently. Well, no. What would it mean? The view is likely to outlast the existence of the function argument. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-

[GENERAL] composite type use in pl/gpsql

2012-06-13 Thread Little, Douglas
Hello, Thanks in advance for taking my question. Running on Greenplum 4.1.2/ based on PG 8.2.3 kernal We make extensive use of functions to do our ETL. So, I'm building a stored procedure template for our developers. I'd like the template to log the sql statements to a logging table for audit/deb

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Merlin Moncure
On Wed, Jun 13, 2012 at 12:31 AM, Divyaprakash Y wrote: > > Hi, > > > > Is the following postgres function correct? > > > > CREATE OR REPLACE FUNCTION "MyFun"("IdArgs" INTEGER) > >     RETURNS SETOF "B" AS > > $BODY$ > >     CREATE VIEW "A"  AS SELECT * FROM "B" WHERE "Id"

Re: [GENERAL] How to create c language in postgresql database. Thanks.

2012-06-13 Thread leaf_yxj
Hi Chris and Guys, Thanks for your answers. I really appreciate it. Although I don't understand the whole things you guys mentioned to me. I think maybe I should do it by myself. I need to do a test. If there is any good guide/white paper, please give me a link for me to study. Thanks. Reg

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Misa Simic
Woops, I thought: CREATE OR REPLACE FUNCTION "MyFun"("IdArgs" INTEGER) RETURNS SETOF "B" AS $BODY$ SELECT * FROM "B" WHERE "Id" = $1; $BODY$ LANGUAGE 'sql' STABLE COST 100; 2012/6/13 Misa Simic > I think temp table, would be better option if you must decide

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Misa Simic
I think temp table, would be better option if you must decide from some reason... However, why would you use View or temp table in that scenario? I mean what would be wrong with: CREATE OR REPLACE FUNCTION "MyFun"(INTEGER) RETURNS SETOF "B" AS $BODY$ SELECT * FROM

Re: [GENERAL] Trying to execute several queries involving temp tables in a PHP script

2012-06-13 Thread Misa Simic
I agree with approach to have all in functions... In that case there would not be a problem with temp tables because of inside 1 transaction they would work... suggestion was just to solve problem from php... what would be achiavable just trough 1 query, or to use PDO and then: $dbh->beginTransac

Re: [GENERAL] Trying to execute several queries involving temp tables in a PHP script

2012-06-13 Thread Leif Biberg Kristensen
Onsdag 13. juni 2012 15.12.33 skrev Alexander Farber : > Any ideas please on how to handle this situation > in PHP scripts, do I really have to encapsulate > my calls into a pl/PgSQL function? I believe that Misa Simic's idea that you can do it all in a single query without temp tables is corre

Re: [GENERAL] Trying to execute several queries involving temp tables in a PHP script

2012-06-13 Thread Misa Simic
Hi Alexander, I think you can have all in one query, without temp tables: SELECT r.rid, r.cards, to_char(r.stamp, 'DD.MM. HH24:MI') as day, c.bid, c.trix, c.pos, c.money, c.last_ip, c.quit, u.id, u.first_name, u.avatar, u.female, u.city, u.vip > CURRENT_

Re: [GENERAL] Trying to execute several queries involving temp tables in a PHP script

2012-06-13 Thread Alban Hertroys
On 13 June 2012 15:12, Alexander Farber wrote: > And when I split my statements into multiple > prepare()/execute() or query() calls, > then the temp. tables aren't found anymore. Did you remember to wrap them in a transaction like you did in your prepared statement? -- If you can't see the for

Re: [GENERAL] PostgreSQL 9.2, SQL functions' named vs numbered parameters.

2012-06-13 Thread Tom Lane
Chris Travers writes: > In another thread it has been mentioned that SQL language functions in > 9.2 will accept named parameters This is correct. > and that you can't mix named and > numbered parameters. This is not correct. You can reference a parameter either by its name or its number, same

[GENERAL] Daisy chaining replication slaves ?

2012-06-13 Thread Rob Cowell
Hi, I'm a postgres newbie (in fact a DB newbie if I'm honest :)) I'm just wondering if there is a way to slave from a slave server? I have a Postgres9.1.3 master serving up data quite happily to the web applications, and I have also set up a slave via streaming replication. I've now been asked b

[GENERAL] Trying to execute several queries involving temp tables in a PHP script

2012-06-13 Thread Alexander Farber
Hello fello PostgreSQL users, with PHP 5.3.3 and PostgreSQL 8.4.11 (and a pgbouncer, but I've tried without it too) I'm trying to execute several SQL queries with 2 temp tables (listed below) and then use the result of a final join to construct a JSON array. Unfortunately my script using prepare/

Re: [GENERAL] Recovery continually requests new WAL files

2012-06-13 Thread Alex Good
On 13/06/12 11:10, Albe Laurenz wrote: Alex Good wrote: Although pgpool is involved this isn't actually about pgpool, I've been running through the recovery process manually to try and understand what needs to be done in order to get onlinve recovery working with pgpool. Pgpool isn't actuall

Re: [GENERAL] Recovery continually requests new WAL files

2012-06-13 Thread Albe Laurenz
Alex Good wrote: > Although pgpool is involved this isn't actually about pgpool, I've been > running through the recovery process manually to try and understand what > needs to be done in order to get onlinve recovery working with pgpool. > Pgpool isn't actually running at the moment. Oh, I see.

Re: [GENERAL] Recovery continually requests new WAL files

2012-06-13 Thread Alex Good
On 13/06/12 10:29, Albe Laurenz wrote: Alex Good wrote: What I expected to see was the server requesting each WAL file up until the one which was archived during pg_stop_backup and then the server would consider itself to be recovered. Clearly I have misunderstood something here. These two se

Re: [GENERAL] Recovery continually requests new WAL files

2012-06-13 Thread Albe Laurenz
Alex Good wrote: > What I expected to see was the server requesting each WAL file up until > the one which was archived during pg_stop_backup and then the server > would consider itself to be recovered. Clearly I have misunderstood > something here. > > These two servers are actually sat behind pg

Re: [GENERAL] PostgreSQL 9.2, SQL functions' named vs numbered parameters.

2012-06-13 Thread Pavel Stehule
2012/6/13 Chris Travers : > Hi; > > In another thread it has been mentioned that SQL language functions in > 9.2 will accept named parameters and that you can't mix named and > numbered parameters.  Can anyone confirm this?   I am a bit concerned > this will break a lot of LSMB stored procedures an

Re: [GENERAL] Recovery continually requests new WAL files

2012-06-13 Thread Albe Laurenz
Alex Good wrote: > I have a simple setup with one master and one backup server. I have an > issue where I have performed a backup and copied it to the data > directory for the slave, written a recovery.conf and copied in the > backup_label file and then started the server, it happily restores > eve

[GENERAL] PostgreSQL 9.2, SQL functions' named vs numbered parameters.

2012-06-13 Thread Chris Travers
Hi; In another thread it has been mentioned that SQL language functions in 9.2 will accept named parameters and that you can't mix named and numbered parameters. Can anyone confirm this? I am a bit concerned this will break a lot of LSMB stored procedures and that we won't be able to support 8.

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Divyaprakash Y
Hey, That works. Thanks for all the replies. The answer for your questions 1. I am using Postgres 8.4. 2. That was the snippet which I was using for the further processing in my function. Also, few questions are as follows: 1. How different the positional parameter is from the named parameter?

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Thomas Kellerer
Chris Travers, 13.06.2012 09:16: If this ever changes, I would certainly hope that the SQL language functions would first be given named argument support. This is coming in 9.2 -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http

Re: [GENERAL] How to create c language in postgresql database. Thanks.

2012-06-13 Thread Chris Travers
On Wed, Jun 13, 2012 at 12:19 AM, Craig Ringer wrote: > On 06/13/2012 12:45 PM, Chris Travers wrote: >> >> On Tue, Jun 12, 2012 at 11:47 AM, John R Pierce >> wrote: >>> >>> On 06/12/12 11:25 AM, leaf_yxj wrote: Thanks. You guys are right. I check the database. The C programm is the

Re: [GENERAL] How to create c language in postgresql database. Thanks.

2012-06-13 Thread Craig Ringer
On 06/13/2012 12:45 PM, Chris Travers wrote: On Tue, Jun 12, 2012 at 11:47 AM, John R Pierce wrote: On 06/12/12 11:25 AM, leaf_yxj wrote: Thanks. You guys are right. I check the database. The C programm is there. - but why our application team keep ask me to give them the superuser priv

Re: [GENERAL] Getting this error

2012-06-13 Thread Craig Ringer
On 06/13/2012 02:23 PM, yatler sahri wrote: Hi I'm running on a program Source code? PostgreSQL version you're using? Database driver (libpq, PgJDBC, psqlODBC, etc) you're using, and its version? Im getting the following error when running the program on postgress Error log from Postgr

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Chris Travers
On Wed, Jun 13, 2012 at 12:06 AM, Alban Hertroys wrote: > On 13 Jun 2012, at 7:31, Divyaprakash Y wrote: > >> Hi, >> >> Is the following postgres function correct? >> >> CREATE OR REPLACE FUNCTION "MyFun"("IdArgs" INTEGER) > > Named parameters ^^^ > > >>                CREATE V

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Craig Ringer
On 06/13/2012 03:06 PM, Alban Hertroys wrote: > Named parameters ^^^ Positional parameters -^^ You can't mix those. I don't think SQL functions support named parameters, so using positional parameters throughout would be the solut

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Craig Ringer
On 06/13/2012 01:31 PM, Divyaprakash Y wrote: CREATE OR REPLACE FUNCTION "MyFun"("IdArgs" INTEGER) RETURNS SETOF "B" AS $BODY$ CREATE VIEW "A" AS SELECT * FROM "B" WHERE "Id" = $1; SELECT * FROM "B"; Executing “select * from "MyFun"(1) “ th

Re: [GENERAL] Create view is not accepting the parameter in postgres functions

2012-06-13 Thread Alban Hertroys
On 13 Jun 2012, at 7:31, Divyaprakash Y wrote: > Hi, > > Is the following postgres function correct? > > CREATE OR REPLACE FUNCTION "MyFun"("IdArgs" INTEGER) Named parameters ^^^ >CREATE VIEW "A" AS SELECT * FROM "B" WHERE "Id" = $1; Positional parameter