Re: [GENERAL] how to save a bytea value into a file?

2011-10-10 Thread Albe Laurenz
fanlijing wrote: When I want to save a bytea value into a file, what should I do? Is there any function dealing with that in PostgreSQL? (like lo_export() to deal with the large-object) (# I didn't find any) If you want to save it in a file on the server, you can use the COPY statement.

[GENERAL] Permission for pg_shadow.

2011-10-10 Thread AI Rumman
I have an application which query on the pg_shadow view. But the user that I was provided by my hosting server does have permission to do that. I checked that only superuser can query in pg_shadow view. But hosting service provider will not give me superuser permission. Is there any other

[GENERAL] i could not found exact steps for using pgp_sym_encrypt() and pgp_sym_decrypt()

2011-10-10 Thread tushar nehete
Hi, i could not found exact steps for using pgp_sym_encrypt() and pgp_sym_decrypt(). I want to encrypt the data of column and then in a function decrypt that column using pgp_sym_encrypt() and pgp_sym_decrypt() functions. Its working fine with postgres 8.4 eg: select

Re: [GENERAL] Postgres 8.4: archive_timeout vs. checkpoint_timeout

2011-10-10 Thread Frank Lanitz
Hi, Thanks for your response. Am 07.10.2011 22:05, schrieb Derrick Rice: On Thu, Oct 6, 2011 at 3:47 AM, Frank Lanitz fr...@frank.uvena.de mailto:fr...@frank.uvena.de wrote: Hi folks, I want to refer to a question Rob did back in 2008 at

Re: [GENERAL] Permission for pg_shadow.

2011-10-10 Thread Alban Hertroys
On 10 October 2011 10:30, AI Rumman rumman...@gmail.com wrote: I have an application which query on the pg_shadow view. But the user that I was provided by my hosting server does have permission to do that. I checked that only superuser can query in pg_shadow view. But hosting service provider

Re: [GENERAL] could not create file base/16384/11500: File exists

2011-10-10 Thread Filip Rembiałkowski
Hello, You gave much too little information. Please see http://wiki.postgresql.org/wiki/Guide_to_reporting_problems Especially: - server version, platform - vacuum-related settings It *might* be OID wraparaound. 2011/10/10 Harshitha S hershe...@gmail.com Hi, We are the following msg in

Re: [GENERAL] could not create file base/16384/11500: File exists

2011-10-10 Thread Harshitha S
Hi, The postgres server version is 9.0.4 on the Linux platform. The vaccum - related settings have default values. If it is OID wrap around, how to resolve it? Regards, Harshitha 2011/10/10 Filip Rembiałkowski plk.zu...@gmail.com Hello, You gave much too little information. Please see

[GENERAL] plpgsql syntax error

2011-10-10 Thread József Kurucz
Hi, I'm beginner in postgresql and plpgsql and i have the following problem. I'm trying to check a table if exists or not and when not exists then create it, but I get a syntax error. Here is my code: create or replace function check_table() returns void as $$ DECLARE mmonth integer; yyear

Re: [GENERAL] could not create file base/16384/11500: File exists

2011-10-10 Thread Harshitha S
Also, this is the case of first startup of the postgres server. This msg is shown in the startup logs. 2011/10/10 Harshitha S hershe...@gmail.com Hi, The postgres server version is 9.0.4 on the Linux platform. The vaccum - related settings have default values. If it is OID wrap around, how

Re: [GENERAL] how to save a bytea value into a file?

2011-10-10 Thread Albe Laurenz
fanlijing wrote: In Fact, I'm doing a porting project from Oracle 10g to PostgreSQL 9.0.4 There is a procedure in Oracle 10g to write a blob value into a file using: [...] I know PostgreSQL doesn't support procedure, so I want to porting it into a function use LANGUAGE plpgsql. So I must

Re: [GENERAL] plpgsql syntax error

2011-10-10 Thread Ondrej Ivanič
Hi, On 10 October 2011 21:35, József Kurucz jozsef.kur...@invitel.hu wrote: ERROR:  syntax error at or near $1 LINE 1: create table  $1  ( )                      ^ QUERY:  create table  $1  ( ) CONTEXT:  SQL statement in PL/PgSQL function check_table near line 22 I think you have to use

Re: [GENERAL] Permission for pg_shadow.

2011-10-10 Thread Albe Laurenz
AI Rumman wrote: I have an application which query on the pg_shadow view. But the user that I was provided by my hosting server does have permission to do that. I checked that only superuser can query in pg_shadow view. But hosting service provider will not give me superuser permission. Is

[GENERAL] Select latest Timestamp values with group by

2011-10-10 Thread Adarsh Sharma
Dear all, I need to write a query to select latest rows with timestamp values. My ID is repeated with lat lon and timestamp. I want the latest row of each ID ( group by id ). Snapshot of small dataset :- 3903;661000212;34.300312542;74.470842472;0;2011-10-10 12:47:33.360572

Re: [GENERAL] Postgres 9.01, Amazon EC2/EBS, XFS, JDBC and lost connections

2011-10-10 Thread Craig Ringer
On 10/07/2011 01:21 AM, Sean Laurent wrote: Within a few seconds of the backup, our application servers start throwing exceptions that indicate the database connection was closed. Meanwhile, Postgres still shows the connections and we start seeing a really high number (for us) of locks in the

Re: [GENERAL] Select latest Timestamp values with group by

2011-10-10 Thread Craig Ringer
On 10/10/2011 08:32 PM, Adarsh Sharma wrote: Dear all, I need to write a query to select latest rows with timestamp values. My ID is repeated with lat lon and timestamp. I want the latest row of each ID ( group by id ). [snip] 3911;661000212;26.8491101532852;92.8058205131302;0;2011-10-14

Re: [GENERAL] could not create file base/16384/11500: File exists

2011-10-10 Thread Filip Rembiałkowski
Is it fresh install of PostgreSQL server? What OS, what installer? Did you run initdb (or pg_ctl initdb), or the installer did it for you? If you want valuable replies you will really need to describe your full story. see http://wiki.postgresql.org/wiki/Guide_to_reporting_problems W dniu 10

Re: [GENERAL] i could not found exact steps for using pgp_sym_encrypt() and pgp_sym_decrypt()

2011-10-10 Thread Craig Ringer
On 10/10/2011 04:37 PM, tushar nehete wrote: Hi, i could not found exact steps for using pgp_sym_encrypt() and pgp_sym_decrypt(). I want to encrypt the data of column and then in a function decrypt that column using pgp_sym_encrypt() and pgp_sym_decrypt() functions. Its working fine with

Re: [GENERAL] Select latest Timestamp values with group by

2011-10-10 Thread Adarsh Sharma
Hi Craig :- Below is the schema of my table :- CREATE TABLE demo_table ( id character varying NOT NULL, lat double precision, lon double precision, speed double precision, dt_stamp timestamp without time zone DEFAULT now(), CONSTRAINT gps_tracker_pkey PRIMARY KEY (id) ) WITH (

Re: [GENERAL] plpgsql syntax error

2011-10-10 Thread Adrian Klaver
On Monday, October 10, 2011 3:35:27 am József Kurucz wrote: Hi, I'm beginner in postgresql and plpgsql and i have the following problem. I'm trying to check a table if exists or not and when not exists then create it, but I get a syntax error. Here is my code: create or replace

[GENERAL] Help on PostgreSQL

2011-10-10 Thread Sarma Chavali
Hi Guys, We are new to PostgreSQL world. But, our company is planning to migrate the one of the existing application to PostgreSQL from Oracle. Could you please help us to find answers to the following questions? 1.What version of PostgreSQL is stable at the moment for production? 2.Is

Re: [GENERAL] how to save a bytea value into a file?

2011-10-10 Thread fanlijing
Hello Laurenz Albe Thank you for your replying. In Fact, I'm doing a porting project from Oracle 10g to PostgreSQL 9.0.4 There is a procedure in Oracle 10g to write a blob value into a file using: ... V_TOTAL_SIZE := DBMS_LOB.GETLENGTH(V_BLOB); V_FILE_TYPE := UTL_FILE.FOPEN('RADIUS_DIR',

Re: [GENERAL] Failure controlling PG 9.1 service on Ubuntu 10.04 32-bit

2011-10-10 Thread Jack Christensen
On 10/8/2011 1:21 AM, Craig Ringer wrote: On 10/08/2011 02:23 AM, Jack Christensen wrote: Just upgraded a machine from PostgreSQL 9.0 to 9.1. I uninstalled the old version then installed the new one. Whenever I try to run a service command to start, stop, or restart the server it fails.

Re: [GENERAL] how to save a bytea value into a file?

2011-10-10 Thread Albe Laurenz
I wrote: [fanlijing wants to write bytea to file] A simple COPY (SELECT byteacol WROM mytab WHERE ...) TO 'filename' (FORMAT binary) should do the trick. Corrections: a) binary must be surrounded by single quotes. b) that won't dump just the binary data - you would have to remove the

[GENERAL] a dumb question regarding RULES

2011-10-10 Thread Rafal Pietrak
Hi all, I've been using RULES for some time now, and despite the fact, that I always had to make experiments to have the expected results, it worked for me just fine. Now I have this simple scenario: --- mbr2=# CREATE TEMP TABLE test(a int, b

Re: [GENERAL] a dumb question regarding RULES

2011-10-10 Thread hubert depesz lubaczewski
On Mon, Oct 10, 2011 at 04:06:34PM +0200, Rafal Pietrak wrote: Hi all, first of all - why did you send this mail as reply to some 2-weeks old thread, instead of just start of new thread? Can someone give a little explenation here ... or point me to for dummies documentation? (yes, I've been

Re: [GENERAL] Help on PostgreSQL

2011-10-10 Thread hubert depesz lubaczewski
On Mon, Oct 10, 2011 at 12:57:42PM +0100, Sarma Chavali wrote: Could you please help us to find answers to the following questions? 1.What version of PostgreSQL is stable at the moment for production? http://www.postgresql.org/ - shows latest release 9.1.1. 2.Is there any enterprise

Re: [GENERAL] Help on PostgreSQL

2011-10-10 Thread Tomas Vondra
On 10 Říjen 2011, 16:50, hubert depesz lubaczewski wrote: On Mon, Oct 10, 2011 at 12:57:42PM +0100, Sarma Chavali wrote: Could you please help us to find answers to the following questions? 1.What version of PostgreSQL is stable at the moment for production? http://www.postgresql.org/ -

Re: [GENERAL] Postgres 9.01, Amazon EC2/EBS, XFS, JDBC and lost connections

2011-10-10 Thread John R Pierce
On 10/06/11 10:21 AM, Sean Laurent wrote: We've been running into a particularly strange problem that I'm trying to better understand. The super short version is that our application servers lose their connection to the database when I run a backup during periods of higher load and fail to

Re: [GENERAL] how to save a bytea value into a file?

2011-10-10 Thread Merlin Moncure
On Mon, Oct 10, 2011 at 9:26 AM, Albe Laurenz laurenz.a...@wien.gv.at wrote: I wrote: [fanlijing wants to write bytea to file] A simple    COPY (SELECT byteacol WROM mytab WHERE ...) TO 'filename' (FORMAT binary) should do the trick. Corrections: a) binary must be surrounded by single

[GENERAL] streaming replication

2011-10-10 Thread Mark Keisler
I have two Pg 9.0.x servers and I have recently started using streaming replication. In monitoring with nagios, I find that almost every day there comes a point when the standby server experiences a delay in replaying transactions (by a few thousand). Receiving is up to date. and of course this

Re: [GENERAL] PostgreSQL consulting companies in the Bay Area

2011-10-10 Thread Steve Crawford
On 10/06/2011 04:48 PM, Richard Price wrote: ... Does anyone know any companies/individuals in the Bay Area who offer PostgreSQL consulting services? Any tips or suggestions would be greatly appreciated!... Check out the San Francisco Bay Area PostgreSQL Meetup:

Re: [GENERAL] select vs cursor/fetch speed disparity

2011-10-10 Thread Bosco Rama
Hi Tom, Tom Lane wrote: Bosco Rama postg...@boscorama.com writes: I have a strange disparity between a query that is run as a straight select and the same query via a cursor. I hope I can jog someone's memory with the description as I have been unable to create a sanitized and/or reduced

[GENERAL] Hot standby won't start

2011-10-10 Thread Brandon Phelps
Hello all, I have written a script which stops postgres on my standby server, executes pg_start_backup on the master, rsync's the data directory and tablespaces over to the standby, executes pg_stop_backup on the master, and attempts to then start postgresql on the standby. My problem is the

Re: [GENERAL] Hot standby won't start

2011-10-10 Thread Merlin Moncure
On Mon, Oct 10, 2011 at 11:30 AM, Brandon Phelps bphe...@gls.com wrote: Hello all, I have written a script which stops postgres on my standby server, executes pg_start_backup on the master, rsync's the data directory and tablespaces over to the standby, executes pg_stop_backup on the master,

[GENERAL] Logging queries cancelled due to replication timeouts

2011-10-10 Thread Christophe Pettus
Greetings, Is there a combination of options that will cause a hot standby replica to log queries that are cancelled due to a replication timeout (max_standby_streaming_delay)? -- -- Christophe Pettus x...@thebuild.com -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org)

Re: [GENERAL] select vs cursor/fetch speed disparity

2011-10-10 Thread Bosco Rama
Bosco Rama wrote: Tom Lane wrote: Cursors are biased towards fast-start plans on the theory that you may not be intending to fetch the whole result. Queries with ORDER BY and/or LIMIT are particularly likely to see plan changes as a consequence of that. In 8.4 and up you can frob the

Re: [GENERAL] a dumb question regarding RULES

2011-10-10 Thread Rafal Pietrak
On Mon, 2011-10-10 at 16:48 +0200, hubert depesz lubaczewski wrote: On Mon, Oct 10, 2011 at 04:06:34PM +0200, Rafal Pietrak wrote: Hi all, first of all - why did you send this mail as reply to some 2-weeks old thread, instead of just start of new thread? Sorry for that. Old habits...

[GENERAL] SELECT statement not working as intended

2011-10-10 Thread Rich Shepard
I'm trying to query the table to extract the single highest value of a chemical by location and date. This statement gives me all the values per stream, site, and date: SELECT str_name, site_id, sample_date, max(quant) FROM chemistry WHERE hydro = 'Humboldt' group by str_name, sample_date,

Re: [GENERAL] SELECT statement not working as intended

2011-10-10 Thread Merlin Moncure
On Mon, Oct 10, 2011 at 5:17 PM, Rich Shepard rshep...@appl-ecosys.com wrote:  I'm trying to query the table to extract the single highest value of a chemical by location and date. This statement gives me all the values per stream, site, and date: SELECT str_name, site_id, sample_date,

Re: [GENERAL] SELECT statement not working as intended

2011-10-10 Thread Henry Drexler
you are also grouping by sample date, those are the largest values for the criteria you have set out in the group by. On Mon, Oct 10, 2011 at 6:17 PM, Rich Shepard rshep...@appl-ecosys.comwrote: I'm trying to query the table to extract the single highest value of a chemical by location and

Re: [GENERAL] SELECT statement not working as intended

2011-10-10 Thread Henry Drexler
for instance CalifCrk| CalCrk | 1996-10-18 |188 CalifCrk| CalCrk | 1996-08-23 |183 CalifCrk| CalCrk | 1996-07-29 |201 CalifCrk| CalCrk | 1996-09-27 |185 188 is the biggest number for 1996-10-18 calcrk califcrk, and so on

Re: [GENERAL] SELECT statement not working as intended

2011-10-10 Thread Rich Shepard
On Mon, 10 Oct 2011, Merlin Moncure wrote: remove the sample_date the group by and the select list. by having it in there you are asking for the max for each specific sample date. merlin, That tells me the max quant but not on what date. Do I write a nested SELECT to get that, too?

Re: [GENERAL] SELECT statement not working as intended

2011-10-10 Thread Rich Shepard
On Mon, 10 Oct 2011, Henry Drexler wrote: you are also grouping by sample date, those are the largest values for the criteria you have set out in the group by. Henry, As I asked Merlin, what is necessary to get the date that maximum quantity was recorded? A nested SELECT? Thanks, Rich

Re: [GENERAL] SELECT statement not working as intended

2011-10-10 Thread John R Pierce
On 10/10/11 3:45 PM, Rich Shepard wrote: As I asked Merlin, what is necessary to get the date that maximum quantity was recorded? A nested SELECT? the complication is, there can be more than one date with the same maximum value, so such a query would be ambiguous, or it would return

[GENERAL] pg 8.3 replication causing corruption

2011-10-10 Thread Bob Hatfield
Should replication cause corruption on the secondary when stopping/starting the primary? (pg 8.3.12, windows 2008 R2 on both servers) Everything seems to work OK, but when we trigger the replication server, it doesn’t pass a reindex. (Errors with can’t create unique indexes due to duplicate

Re: [GENERAL] SELECT statement not working as intended

2011-10-10 Thread Rich Shepard
On Mon, 10 Oct 2011, John R Pierce wrote: the complication is, there can be more than one date with the same maximum value, so such a query would be ambiguous, or it would return multiple rows. John, The likelihood of that is diminishingly small. Thanks, Rich -- Sent via pgsql-general

Re: [GENERAL] SELECT statement not working as intended

2011-10-10 Thread Scott Marlowe
On Mon, Oct 10, 2011 at 6:14 PM, Scott Marlowe scott.marl...@gmail.com wrote: On Mon, Oct 10, 2011 at 4:17 PM, Rich Shepard rshep...@appl-ecosys.com wrote:  I'm trying to query the table to extract the single highest value of a chemical by location and date. This statement gives me all the

Re: [GENERAL] SELECT statement not working as intended

2011-10-10 Thread Scott Marlowe
On Mon, Oct 10, 2011 at 4:17 PM, Rich Shepard rshep...@appl-ecosys.com wrote:  I'm trying to query the table to extract the single highest value of a chemical by location and date. This statement gives me all the values per stream, site, and date: SELECT str_name, site_id, sample_date,

Re: [GENERAL] SELECT statement not working as intended

2011-10-10 Thread Rob Sargent
On 10/10/2011 05:52 PM, Rich Shepard wrote: On Mon, 10 Oct 2011, John R Pierce wrote: the complication is, there can be more than one date with the same maximum value, so such a query would be ambiguous, or it would return multiple rows. John, The likelihood of that is diminishingly

Re: [GENERAL] pg 8.3 replication causing corruption

2011-10-10 Thread John R Pierce
On 10/10/11 4:12 PM, Bob Hatfield wrote: Should replication cause corruption on the secondary when stopping/starting the primary? I wasn't aware 8.3 had any built in replication? what sort of replication add-ons are you using? -- john r pierceN 37, W 122 santa

[GENERAL] Should casting to integer produce same result as trunc()

2011-10-10 Thread Harvey, Allan AC
Hi all, Had to squash timestamps to the nearest 5 minutes and things went wrong. My simple understanding of trunc() and casting to an integer says that there is a bug here. Expect it is my understanding though. Can someone set me straight? And thank you all for a wonderfull RDBMS. Allan

[GENERAL] Re:You can miss your happiness! Don’t doubt! It’s the best thing in the world!

2011-10-10 Thread Andrew Magnus
.How are you! I think you’ll like it! Read this message! http://www.lecki.boo.pl/com.friend.php?imiID=67ez3 -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Help on PostgreSQL

2011-10-10 Thread Craig Ringer
On 10/10/11 19:57, Sarma Chavali wrote: Hi Guys, We are new to PostgreSQL world. But, our company is planning to migrate the one of the existing application to PostgreSQL from Oracle. Could you please help us to find answers to the following questions? 1.What version of

Re: [GENERAL] Postgres 9.01, Amazon EC2/EBS, XFS, JDBC and lost connections

2011-10-10 Thread Craig Ringer
On 10/10/11 23:29, John R Pierce wrote: While xfs_freeze is in effect, all writes are blocked. This is NOT what you want to do here, postgres does NOT expect you to take an atomic snapshot of the database files, rather, by bracketing your backup with pg_start_backup and pg_stop_backup, it

Re: [GENERAL] Help on PostgreSQL

2011-10-10 Thread Scott Marlowe
On Mon, Oct 10, 2011 at 8:25 PM, Craig Ringer ring...@ringerc.id.au wrote: On 10/10/11 19:57, Sarma Chavali wrote: Hi Guys, We are new to PostgreSQL world.  But, our company is planning to  migrate the one of the existing application to PostgreSQL from Oracle.  Could you please help us

Re: [GENERAL] Select latest Timestamp values with group by

2011-10-10 Thread Adarsh Sharma
Any update on the below query :- I tried the below query but :- * select bb_id,lat,lon,max(dt_stamp) from gps_tracker group by bb_id; * ERROR: column gps_tracker.lat must appear in the GROUP BY clause or be used in an aggregate function LINE 1: select bb_id,lat,lon,max(dt_stamp) from

Re: [GENERAL] Postgres 9.01, Amazon EC2/EBS, XFS, JDBC and lost connections

2011-10-10 Thread John R Pierce
On 10/10/11 7:44 PM, Craig Ringer wrote: If blocking writes causes a server failure that persists once writes have been unblocked, that's a bug IMO. You might have a bit of a backlog of writes to clear, but after that all should be well, and if it isn't then something needs fixing. the process

Re: [GENERAL] Select latest Timestamp values with group by

2011-10-10 Thread Adarsh Sharma
Thanks Craig, but I solved the issue by the below query :- Here is the query for that :- select bb_id,lat,lon,speed,dt_stamp from demo_table inner join (select bb_id as did, max(dt_stamp) as ts from demo_table group by bb_id) as ds on demo_table1.bb_id = ds.did and demo_table1.dt_stamp =

Re: [GENERAL] Postgres 9.01, Amazon EC2/EBS, XFS, JDBC and lost connections

2011-10-10 Thread Craig Ringer
On 11/10/11 12:48, John R Pierce wrote: On 10/10/11 7:44 PM, Craig Ringer wrote: If blocking writes causes a server failure that persists once writes have been unblocked, that's a bug IMO. You might have a bit of a backlog of writes to clear, but after that all should be well, and if it isn't

Re: [GENERAL] Select latest Timestamp values with group by

2011-10-10 Thread Craig Ringer
On 11/10/11 12:55, Adarsh Sharma wrote: Thanks Craig, but I solved the issue by the below query :- Here is the query for that :- select bb_id,lat,lon,speed,dt_stamp from demo_table inner join (select bb_id as did, max(dt_stamp) as ts from demo_table group by bb_id) as ds on

Re: [GENERAL] Help on PostgreSQL

2011-10-10 Thread Raghavendra
Hi Guys, We are new to PostgreSQL world. But, our company is planning to migrate the one of the existing application to PostgreSQL from Oracle. 2.Is there any enterprise version available with all features? The free PostgreSQL comes with all available features; it's not a lite