Re: [GENERAL] Need magic to clean strings from unconvertible UTF8

2010-11-06 Thread John R Pierce
On 11/06/10 9:35 PM, Andreas wrote: Hi, somehow there have unconvertible characters sneaked into my DB. Very probaply they came in via Imports from MS-Access. Access doesn't complain but when I try to export stuff with pgAdmin to csv I get an error that some char is not representable in the lo

[GENERAL] Need magic to clean strings from unconvertible UTF8

2010-11-06 Thread Andreas
Hi, somehow there have unconvertible characters sneaked into my DB. Very probaply they came in via Imports from MS-Access. Access doesn't complain but when I try to export stuff with pgAdmin to csv I get an error that some char is not representable in the local charset. I can find the problem

Re: [GENERAL] Libpq is very slow on windows but fast on linux.

2010-11-06 Thread John R Pierce
On 11/06/10 6:27 PM, Rob Brown-Bayliss wrote: On Sun, Nov 7, 2010 at 1:06 PM, John R Pierce wrote: how about if you do something like, SELECT * FROM SOME_TABLE INTO SOME_OTHER_TABLE; which doesn't involve returning data? In this case the times are as close to equal as to make no difference,

Re: [GENERAL] Libpq is very slow on windows but fast on linux.

2010-11-06 Thread John R Pierce
On 11/06/10 6:13 PM, Rob Brown-Bayliss wrote: Ok, So I did that, in the windows capture file are many many lines of Red text on a black background, I assume thats a bad thing. It's every second or third line vs just a handful on the linux capture. Most of these lines are like: postgresql [ACK]

Re: [GENERAL] Libpq is very slow on windows but fast on linux.

2010-11-06 Thread Rob Brown-Bayliss
On Sun, Nov 7, 2010 at 1:06 PM, John R Pierce wrote: > how about if you do something like, SELECT * FROM SOME_TABLE INTO > SOME_OTHER_TABLE;  which doesn't involve returning data? In this case the times are as close to equal as to make no difference, within a couple of ms of each other. About 3

Re: [GENERAL] Libpq is very slow on windows but fast on linux.

2010-11-06 Thread Rob Brown-Bayliss
Ok, So I did that, in the windows capture file are many many lines of Red text on a black background, I assume thats a bad thing. It's every second or third line vs just a handful on the linux capture. Most of these lines are like: postgresql [ACK] Seq=5429 Ack=# Win=65700 Len=0 Where the

Re: [GENERAL] Finding rank of a single record

2010-11-06 Thread Rob Sargent
Alexander Farber wrote: Hello, I have 2 tables with user infos (please see \d output at the bottom) and would like to find their rank depending on their "money". When I select all records, the rank() works fine: pref=> select u.first_name, u.city, m.money, rank() over (order by money desc) fro

Re: [GENERAL] PITR on different machine/architecture?

2010-11-06 Thread Craig Ringer
On 11/06/2010 02:48 AM, Vick Khera wrote: On Fri, Nov 5, 2010 at 1:54 PM, Andreas Brandl wrote: we are implementing archiving/PITR for a postgresql instance operating on OpenBSD/64-bit. Is it possible to restore the backup on a completely different machine (i.e. other OS/32-bit)? What about r

Re: [GENERAL] Libpq is very slow on windows but fast on linux.

2010-11-06 Thread John R Pierce
On 11/06/10 5:12 PM, Rob Brown-Bayliss wrote: On Sun, Nov 7, 2010 at 1:06 PM, John R Pierce wrote: I think I'd run a packet sniffer like Wireshark on both client platforms, sniffing 5432/tcp and see if there's something unusual in the timing of the packets, incorrect MTU or something, lost pack

Re: [GENERAL] Libpq is very slow on windows but fast on linux.

2010-11-06 Thread Rob Brown-Bayliss
On Sun, Nov 7, 2010 at 1:06 PM, John R Pierce wrote: > when you say 500mS, thats the round trip ping time? It's a bit less, for example SELECT max(id) on the same table takes about 350ms. Yes, I am in New Zealand, the server is in Canada. pings take about 275ms average. > I think I'd run a pack

Re: [GENERAL] Libpq is very slow on windows but fast on linux.

2010-11-06 Thread Rob Brown-Bayliss
Thanks, but no, it's using ip, and after the connection has been established etc. the 3500ms it the total query time on windows vs 800ms on linux. Same server, so I think it is related to libpq implementation on windows. I also get the same results running XP in a virtualbox on a linux machine, w

Re: [GENERAL] Libpq is very slow on windows but fast on linux.

2010-11-06 Thread John R Pierce
On 11/06/10 4:54 PM, Rob Brown-Bayliss wrote: Hi I have a problem with libpq on windows. Connecting to a db and running a "select * from some_table;" is very slow. The table has only 1800 rows, 7 columns. No blobs etc. The query is taking around 3500ms, in linux it takes around 800ms. (About 5

Re: [GENERAL] Libpq is very slow on windows but fast on linux.

2010-11-06 Thread Joe Conway
On 11/06/2010 04:54 PM, Rob Brown-Bayliss wrote: > Hi > > I have a problem with libpq on windows. Connecting to a db and running > a "select * from some_table;" is very slow. > > The table has only 1800 rows, 7 columns. No blobs etc. > > The query is taking around 3500ms, in linux it takes aroun

[GENERAL] Libpq is very slow on windows but fast on linux.

2010-11-06 Thread Rob Brown-Bayliss
Hi I have a problem with libpq on windows. Connecting to a db and running a "select * from some_table;" is very slow. The table has only 1800 rows, 7 columns. No blobs etc. The query is taking around 3500ms, in linux it takes around 800ms. (About 500ms is network time, the server is on the oppos

[GENERAL] Finding rank of a single record

2010-11-06 Thread Alexander Farber
Hello, I have 2 tables with user infos (please see \d output at the bottom) and would like to find their rank depending on their "money". When I select all records, the rank() works fine: pref=> select u.first_name, u.city, m.money, rank() over (order by money desc) from pref_users u, pref_money

Re: [GENERAL] avoiding nested loops when joining on partitioned tables

2010-11-06 Thread Jasen Betts
On 2010-10-31, Peter Neal wrote: > --0016363b85c479ce9d0493f14f93 > Content-Type: text/plain; charset=ISO-8859-1 > > Hi, > > I have two tables (A and B), which are partitioned (A1, A2... B1, B2...) for > easy deletion of old records. They are linked by a bigint column "id", which > is defined as a

Re: [GENERAL] Thoughts on a surrogate key lookup function?

2010-11-06 Thread Nick
Merlin, thanks for the reply. Yes, using email_addresses was a very silly example. Maybe the following is a better example... CREATE TABLE first_names (id INT, first_name VARCHAR); ALTER TABLE first_names ADD CONSTRAINT first_names_pkey PRIMARY KEY (id,first_name); ALTER TABLE first_names ADD CONS

Re: [GENERAL] Re: Modfying source code to read tuples before and after UPDATE...how to?

2010-11-06 Thread John R Pierce
On 11/05/10 9:23 AM, rmd22 wrote: Well what i mean by print out is that it should print out the old and new tuples on postgres terminal after the update is complete. I tried it with triggers and I got what I wanted. But my professor for some reason wants me to mess around with the source code :(

Re: [GENERAL] Thoughts on a surrogate key lookup function?

2010-11-06 Thread Merlin Moncure
On Fri, Nov 5, 2010 at 5:27 PM, Nick wrote: > Are there any existing trigger functions (preferably C) that could > retrieve a missing value for a compound foreign key on insert or > update? If this overall sounds like a really bad idea, please let me > know as well. This functionality could really

Re: [GENERAL] Save and load jpg in a PostgreSQL database

2010-11-06 Thread Dmitriy Igrishin
Hey Fernando, There is no pg_escape_bytea() in PostgreSQL. It seem like a function of some PL, like PHP or Tcl... So, the command that you found on a forum is incorrect. As I understand, you want to upload a file from your (client) filesystem to the PostgreSQL database (server) and store it in the

Re: [GENERAL] Re: Modfying source code to read tuples before and after UPDATE...how to?

2010-11-06 Thread Jacqui Caren-home
rmd22 wrote: Do you think it's possible? replied offlist suggesting he have a chat with his prof and find the reason behind this task... -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Thoughts on a surrogate key lookup function?

2010-11-06 Thread Nick
Are there any existing trigger functions (preferably C) that could retrieve a missing value for a compound foreign key on insert or update? If this overall sounds like a really bad idea, please let me know as well. This functionality could really speed my project up though. For example, CREATE TA