Re: [GENERAL] Errors using JDBC batchUpdate with plpgsql function

2015-05-04 Thread Hannes Erven
Hi, > String sql = "select test_user_result_insert_func(?, ?, ?);"; You can't call functions via JDBC like that. You need to use: CallableStatement cs = connection.prepareCall("{call func(?,?,?)}"); // Loop starts... cs.clearParameters(); cs.setString(1, "foo"); cs.setString(2, "bar"

Re: [GENERAL] How to parse xml containing optional elements

2016-08-11 Thread Hannes Erven
Hi Andrus, SELECT unnest(xpath('/ns:Document/ns:BkToCstmrStmt/ns:Stmt/ns:Ntry/ns:Amt/text()', x,nsa))::text::numeric AS tasusumma , unnest(xpath('/ns:Document/ns:BkToCstmrStmt/ns:Stmt/ns:Ntry/ns:NtryDtls/ns:TxDtls/ns:Refs/ns:EndToEndId/text()', x,nsa))::text AS orderinr FROM t; You ne

Re: [GENERAL] How to parse xml containing optional elements

2016-08-11 Thread Hannes Erven
Hi, Thank you. In "PostgreSQL 9.1.2 on x86_64-unknown-linux-gnu, compiled by gcc-4.4.real (Debian 4.4.5-8) 4.4.5, 64-bit" it returns two empty rows. How to make it work in this version ? I couldn't really believe this so I just installed a VM and a 9.1 postgresql just to test this for you.

Re: [GENERAL] How to parse xml containing optional elements

2016-08-12 Thread Hannes Erven
Andrus, Psotgres 9.1 run isn Debian Squeeze which is unsupported. How to upgrade in Debian Squeeze ? A plain "apt-get upgrade postgresql-9.1" does not work? It might help to enable the postgresql.org APT repository. For instructions, see here: https://www.postgresql.org/download/linux/debia

Re: [GENERAL] How to parse xml containing optional elements

2016-08-12 Thread Hannes Erven
Hi, apt-get upgrade postgresql-9.1 returns Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt-get -f install' to correct these. The following packages have unmet dependencies: openssl : Depends: libssl1.0.0 (>= 1.0.1e-2+deb7u5) b

Re: [GENERAL] A contradiction in 13.2.1

2016-01-27 Thread Hannes Erven
Dane, > So the mental model I've built based on the first four sentences of > the first paragraph is that when a transaction starts in read > committed mode a snapshot is taken of the (database) universe as it > exists at the moment of its creation and that it's only updated by > changes made by

Re: [GENERAL] Migrate 2 DB's - v8.3

2016-05-27 Thread Hannes Erven
Jeff, is (temporarily) migrating the whole cluster an option? What I have in mind is roughly this: - rsync/copy complete db dir to target (with src still being in production), throttle/repeat as necessary - stop source db - rsync again - start src + target dbs - drop moved databases in src - dr

Re: [GENERAL] Migrate 2 DB's - v8.3

2016-05-28 Thread Hannes Erven
Hi Jeff, > Thank you for the message. --- I like your idea, but one thing I > forgot to mention is that my target postgres cluster has production > DB's running on it already. Oh, that's important information. The only way to "merge" additional databases into an existing cluster would be dum

[GENERAL] "Cascading Logical Replication" from a physical replica

2017-11-13 Thread Hannes Erven
ems to be quite complex compared to just reading the WAL off the standby where it already is, ideally using the logical output plugin interface to format the data. Thanks for any insights! Best regards, -hannes erven -- Sent via pgsql-general mailing list (pgsql-general@postgresql.o

[GENERAL] Per-session memory footprint (9.0/windows)

2011-03-02 Thread Hannes Erven
Folks, I run a PG (currently 8.4, but will shortly migrate to 9.0) database on Windows Server 2003 that supports a desktop application which opens a few long-running sessions per user. This is due to the Hibernate persistence layer and the "one session per view" pattern that is recommended for su

Re: [GENERAL] Per-session memory footprint (9.0/windows)

2011-03-02 Thread Hannes Erven
Scott, > It seems that each of the server postmaster.exe processes takes up > approx. 5 MB of server memory (the "virtual memory size" column in task > manager), and I guess this truly is the private memory these processes > require. This number is roughly the same for 8.4 and 9.0

Re: [GENERAL] Postgres 8.3 vs. 8.4 - Query plans and performance

2011-03-14 Thread Hannes Erven
Jo, > we have performance problems running several queries pon postgres 8.4 . > Using the previous version (8.3) our queries performs well > (The queries are quite complex, consisting of several sub-queries and > various spatial functions). > > Are there some major changes from 8.3 to 8.4 that ca

Re: [GENERAL] Rewritten rows on unchanged values

2013-03-22 Thread Hannes Erven
Hi folks, On 2013-03-22 13:32, Bertrand Janin wrote: >UPDATE demo >SET value = value >WHERE id = 1; On 2013-03-22 14:55, Tom Lane wrote: > It's not *necessary* to do so. However, avoiding it would require sitting there and comparing the old and new tuples, But in this case, no

Re: [GENERAL] Fwd: JDBC Array double precision [] error

2013-03-31 Thread Hannes Erven
Hi Juan Pablo, > double[] array = (double[]) rs1.getArray("histograma").getArray(); java.lang.ClassCastException: [Ljava.lang.Double; cannot be cast to [D The error message already tells you the solution: use Double, not double. Like this: Double[] array = (Double[]) rs1.getArray("histogra

Re: [GENERAL] Autovacuum stuck for hours, blocking queries

2017-02-17 Thread Hannes Erven
Hi Tim, Am 2017-02-15 um 18:30 schrieb Tim Bellis: I have a postgres 9.3.4 database table which (intermittently but reliably) > gets into a state where queries get blocked indefinitely > [..] Notes: - This database table is used for about 6 million row writes per day, > all of which a

Re: [GENERAL] Autovacuum stuck for hours, blocking queries

2017-02-17 Thread Hannes Erven
e; INSERT INTO yourtable SELECT * from keep; COMMIT; Best regards, -hannes -Original Message- From: Hannes Erven [mailto:han...@erven.at] Sent: 17 February 2017 11:47 To: pgsql-general@postgresql.org Cc: Tim Bellis Subject: Re: [GENERAL] Autovacuum stuck for hours, blocking querie

Re: [GENERAL] Table Vacuum Taking a Long Time

2014-04-02 Thread Hannes Erven
Hi Eliot, > If I continue to run vacuum > analyze on it, it continues to take about 90 seconds each time. > [..] > I was under the impression that if nothing had been done to the table > since it was last vacuumed, that it would return immediately. in addition to what others already said, I'd e

Re: [GENERAL] Need some help in postgres locking mechanism

2014-04-08 Thread Hannes Erven
Hi, On 2014-04-08 15:27, Vick Khera wrote: [...] Problem 2: you cannot have a second process skip over locked rows. In fact, you can: use "FOR UPDATE NOWAIT" and catch any errors. e.g. SELECT * FROM jobqueue WHERE id=? FOR UPDATE NOWAIT -hannes -- Sent via pgsql-general mailing list (p

Re: [GENERAL] Postgresql the right tool (queue using advisory_locks + long transactions)

2014-04-27 Thread Hannes Erven
Hi, On 2014-04-27 21:53, Tom Lane wrote: > Sitting on an open transaction for hours would be a bad idea. I'm wondering why this is and what the consequences might be - I thought, the MVCC model would handle that rather well? Could please someone elaborate on this or provide some pointer? T

Re: [GENERAL] Postgres 8.0 upgrade to 9.0

2011-08-01 Thread Hannes Erven
Atul, > 2) Do I need to upgrade JDBC driver when I upgrade to postgres9.0. Yes, at least if you use BLOB types. The 9.0 server sends them in a format former JDBC drivers cannot understand: http://www.postgresql.org/docs/9.0/static/runtime-config-client.html#GUC-BYTEA-OUTPUT Other than that

Re: [GENERAL] Re: Need help with what I think is likely a simple query - for each distinct val, return only one record with the most recent date.

2011-09-13 Thread Hannes Erven
Reid, > where any one of these 3 > > 11 2011-01-01 > 11 2011-01-01 > 13 2011-01-01 > > or any one of these 2 > 31 2011-01-05 > 32 2011-01-05 > > are suitable for val = 1, val = 3 respectively. Can you please describe in words what you are trying

[GENERAL] Replication between 64/32bit systems?

2011-09-20 Thread Hannes Erven
Hi folks, I'm planning to set up streaming replication from one master to one slave. I've read at http://www.postgresql.org/docs/9.1/static/warm-standby.html that the "hardware architecture" of both systems must be the same. Sure enough, what I'd really like to do is replicate from a Windows (or

Re: [GENERAL] Replication between 64/32bit systems?

2011-09-22 Thread Hannes Erven
Folks, >> Sure enough, what I'd really like to do is replicate from a Windows >> (or Linux) 64bit master to a Linux 32bit slave -- that's what I >> currently have easily available. thank you for your replies -- unfortunately, I'm not very content with "it simply won't work" without understandin

Re: [GENERAL] Replication between 64/32bit systems?

2011-09-23 Thread Hannes Erven
OK, thank you for clarification, I'll "resign" ;-) and accept that mixing 32/64 bits is not possible. I continued by experiments, and would like to share my results. First of all, I'm an idiot because I had logging_collector set to on and wondered why the terminals did not give any meaningful o

[GENERAL] Revert TRUNCATE CASCADE?

2012-10-22 Thread Hannes Erven
Hi all, today I ran into an issue I believed to be a FAQ, but fortunately it doesn't seem so as I could find any resources related to this... :-/ A misguided click in PGADMIN executed a "TRUNCATE CASCADE" on a rather central table of my schema, which resulted in most important tables being

Re: [GENERAL] 9.1 replication on different arch

2011-11-04 Thread Hannes Erven
Am 2011-11-03 02:40, schrieb Martín Marqués: > > Sad thing is that it's not so easy on Debian. With Fedora all I had to > do is select the arch type and that's all. Have a look at "dpkg --force-architecture" . -hannes -- Sent via pgsql-general mailing list (pgsql-general@postgresql.or

Re: [GENERAL] 9.1 replication on different arch

2011-11-04 Thread Hannes Erven
2011-11-04 16:24, Martín Marqués: >> Have a look at "dpkg --force-architecture" . > > The thing is that perl needs libdbd-pg-perl to connect, which needs > libpq5, all this in amd64, but the i386 of postgresql-9.1 needs an > i386 version of libpq5 Oh, I see, that's a mess. Probably there really i

Re: [GENERAL] Feature Request: Better handling of foreign keys in DELETE statements

2011-12-19 Thread Hannes Erven
Hi Daniel, > Now I wanted to delete about 10 million addresses (that are not > referenced anymore from anywhere), and have a statement like: What about: DELETE FROM address WHERE id IN ( SELECT id FROM address EXCEPT ( SELECT address_id FROM tab1 UNION AL

Re: [GENERAL] Adding German Character Set to PostgresSQL

2012-01-02 Thread Hannes Erven
Hagen, > gpdemo=# \encoding > UTF8 UTF8 includes virtually all characters you will need for any purpose on the earth. But: you showed the output of \encoding when you were asked to show \l . There is a subtle difference: \encoding shows the encoding of the connection between psql and the ser

Re: [GENERAL] Adding German Character Set to PostgresSQL

2012-01-02 Thread Hannes Erven
Hi Hagen, > gpdemo | gpadmin | UTF8 | > that UTF8 ought to support the German characters I want. > Am I understanding you correctly? Yes, UTF-8 supports all the characters you'd want -- Wikipedia says it's about 109.000 characters from 93 scripts, so that's pretty everything you migh