Re: [GENERAL] Default timezone changes in 9.1

2012-12-16 Thread Andres Freund
Hi, On 2012-12-15 22:07:32 -0500, Terence Ferraro wrote: > We recently began upgrading our clients' servers from 9.0 -> 9.2. After a > few deployments and a little digging we noticed that 9.0 -> 9.1 broke the > use of no timezone set within postgresql.conf. That is, not setting the > option was no

[GENERAL] Authenticate with hash instead of plaintext password?

2012-12-16 Thread Murray Cumming
libpq lets me open a connection by specifying a password: http://www.postgresql.org/docs/9.2/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS Is there any way to specify a hash of the password when connecting, instead of providing the password itself? My Web UI asks the user for a PostgreSQL userna

[GENERAL] How to remove n-first elements from array?

2012-12-16 Thread aasat
Hi, I have array for example do $$ declare v_arr integer[] := array[1, 2, 3, 4, 5]; begin end; $$ I want to remove 2 first element and get array with non-changed indexes (subscript) new array := '[3:5]={3, 4, 5}'::integer[] It is possible in pl/pgsql? -- View this message in context: htt

Re: [GENERAL] Authenticate with hash instead of plaintext password?

2012-12-16 Thread Peter Bex
On Sun, Dec 16, 2012 at 04:54:30PM +0100, Murray Cumming wrote: > libpq lets me open a connection by specifying a password: > http://www.postgresql.org/docs/9.2/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS > > Is there any way to specify a hash of the password when connecting, instead > of > pr

Re: [GENERAL] Authenticate with hash instead of plaintext password?

2012-12-16 Thread Murray Cumming
On Sun, 2012-12-16 at 17:24 +0100, Peter Bex wrote: > On Sun, Dec 16, 2012 at 04:54:30PM +0100, Murray Cumming wrote: > > libpq lets me open a connection by specifying a password: > > http://www.postgresql.org/docs/9.2/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS > > > > Is there any way to speci

[GENERAL] The fastes way to sum array of integers

2012-12-16 Thread aasat
Hi, I sum values of array integers by query select sum(t) from unnest(array[1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0]) as t cross join generate_series(1, 100); Total runtime: 10020.699 ms But simmilar method to count array's elements is dramatically faster select sum(array_length(

Re: [GENERAL] The fastes way to sum array of integers

2012-12-16 Thread Pavel Stehule
2012/12/16 aasat : > Hi, > > I sum values of array integers by query > > select sum(t) > from unnest(array[1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0]) as t > cross join generate_series(1, 100); > > Total runtime: 10020.699 ms > > But simmilar method to count array's elements is dramatic

Re: [GENERAL] Authenticate with hash instead of plaintext password?

2012-12-16 Thread Peter Bex
On Sun, Dec 16, 2012 at 05:38:37PM +0100, Murray Cumming wrote: > On Sun, 2012-12-16 at 17:24 +0100, Peter Bex wrote: > > What's the use of that? > [snip] > > I would not be storing the plaintext password anywhere. That makes it > harder for someone get the plaintext password if they break into th

Re: [GENERAL] Default timezone changes in 9.1

2012-12-16 Thread Tom Lane
Terence Ferraro writes: > Post 9.1, the system determines this via initdb data directory > initialization and automatically sets it within postgresql.conf. > In other words, the default now is *not* GMT but rather the system detected > timezone at initdb runtime. Removing that statically set confi

Re: [GENERAL] Default timezone changes in 9.1

2012-12-16 Thread Tom Lane
Andres Freund writes: > Setting the timezone to 'localtime' seems to work as well, even without > a patch. I haven't found any documentation about it and I am not > completely sure about the semantics, but it looks ok on a first glance. I think on most distros that use the Olson tz database, 'loc

Re: [GENERAL] Authenticate with hash instead of plaintext password?

2012-12-16 Thread Peter Bex
On Sun, Dec 16, 2012 at 05:51:23PM +0100, Peter Bex wrote: > The best solution I can come up with is not provide a web UI at all > but let the user connect directly to the database using a secure > method (e.g. SSL client certs, GSSAPI etc). Speaking of which, a custom implementation of the GSSAPI

Re: [GENERAL] Default timezone changes in 9.1

2012-12-16 Thread Andres Freund
On 2012-12-16 12:25:13 -0500, Tom Lane wrote: > Andres Freund writes: > > Setting the timezone to 'localtime' seems to work as well, even without > > a patch. I haven't found any documentation about it and I am not > > completely sure about the semantics, but it looks ok on a first glance. > > I t

Re: [GENERAL] Need help for import of text file

2012-12-16 Thread Andreas
Am 15.12.2012 22:22, schrieb Peter Bex: On Sat, Dec 15, 2012 at 10:16:55PM +0100, Peter Bex wrote: A simple sed(1) expression should do the trick: sed -E 's/ +/ /g' old-file > new-file I just remembered where I could check, and the GNU sed equivalent is: sed -r 's/ +/ /g' old-file > new-file

Re: [GENERAL] Authenticate with hash instead of plaintext password?

2012-12-16 Thread Tom Lane
Peter Bex writes: > On Sun, Dec 16, 2012 at 05:38:37PM +0100, Murray Cumming wrote: >> I would not be storing the plaintext password anywhere. That makes it >> harder for someone get the plaintext password if they break into the >> server, and therefore harder for someone to use that password to b

Re: [GENERAL] Authenticate with hash instead of plaintext password?

2012-12-16 Thread Peter Bex
On Sun, Dec 16, 2012 at 12:51:08PM -0500, Tom Lane wrote: > Peter Bex writes: > > If they do break in and are able to retrieve the password hash, they > > can still break in with that hash. > > Right, they can break into *this account*. Not *just* this one, but any account on any service that us

Re: [GENERAL] Need help for import of text file

2012-12-16 Thread Peter Bex
On Sun, Dec 16, 2012 at 06:48:35PM +0100, Andreas wrote: > With sed as startingpoint I figured it out. > Those 3 steps make the input files consumable for COPY > > 1. dos2unix > 2. sed -i 's/[ \t]*$//' > 3. sed -i 's/ / /g' You can reduce this to one invocation by separating the commands by a se

Re: [GENERAL] Default timezone changes in 9.1

2012-12-16 Thread Tom Lane
Andres Freund writes: > On 2012-12-16 12:25:13 -0500, Tom Lane wrote: >> I'm still not sure what >> the OP actually wants to accomplish by moving the time of making the >> choice. > I guess he wants - and I have seen that before - to use the same > postgresql.conf across a number of different sys

Re: [GENERAL] Authenticate with hash instead of plaintext password?

2012-12-16 Thread Tom Lane
Peter Bex writes: > On Sun, Dec 16, 2012 at 12:51:08PM -0500, Tom Lane wrote: >> Right, they can break into *this account*. > Not *just* this one, but any account on any service that uses this > same algorithm. That's easily fixed. I'd be inclined to make the "password" hash be a hash of the ac

Re: [GENERAL] Authenticate with hash instead of plaintext password?

2012-12-16 Thread Murray Cumming
On Sun, 2012-12-16 at 17:51 +0100, Peter Bex wrote: > On Sun, Dec 16, 2012 at 05:38:37PM +0100, Murray Cumming wrote: > > On Sun, 2012-12-16 at 17:24 +0100, Peter Bex wrote: > > > What's the use of that? > > [snip] > > > > I would not be storing the plaintext password anywhere. That makes it > > h

Re: [GENERAL] Authenticate with hash instead of plaintext password?

2012-12-16 Thread Peter Bex
On Sun, Dec 16, 2012 at 01:30:29PM -0500, Tom Lane wrote: > Peter Bex writes: > > On Sun, Dec 16, 2012 at 12:51:08PM -0500, Tom Lane wrote: > >> Right, they can break into *this account*. > > > Not *just* this one, but any account on any service that uses this > > same algorithm. > > That's easi

[GENERAL] PG 8.4 to 9.2 upgrade issues with ownership of large objects

2012-12-16 Thread David Wall
In past PG upgrades, we've done a pg_dump on the current version, then a pg_restore on the new version. But during the 8.4 to 9.2 upgrade (on Linux x64), we ran into issues with the permissions associated with the large objects after the restore. Is this something new or were we just "lucky"

Re: [GENERAL] Authenticate with hash instead of plaintext password?

2012-12-16 Thread Peter Bex
On Sun, Dec 16, 2012 at 07:42:40PM +0100, Murray Cumming wrote: > On Sun, 2012-12-16 at 17:51 +0100, Peter Bex wrote: > > Hashes (if properly salted and > > stretched) are only useful if they are only ever checked against the > > password itself. Storing a hash of any kind and comparing that direc

Re: [GENERAL] Authenticate with hash instead of plaintext password?

2012-12-16 Thread Adrian Klaver
On 12/16/2012 11:07 AM, Peter Bex wrote: On Sun, Dec 16, 2012 at 07:42:40PM +0100, Murray Cumming wrote: On Sun, 2012-12-16 at 17:51 +0100, Peter Bex wrote: Hashes (if properly salted and stretched) are only useful if they are only ever checked against the password itself. Storing a hash of an

Re: [GENERAL] PG 8.4 to 9.2 upgrade issues with ownership of large objects

2012-12-16 Thread Adrian Klaver
On 12/16/2012 11:09 AM, David Wall wrote: In past PG upgrades, we've done a pg_dump on the current version, then a pg_restore on the new version. But during the 8.4 to 9.2 upgrade (on Linux x64), we ran into issues with the permissions associated with the large objects after the restore. Is thi

Re: [GENERAL] PG 8.4 to 9.2 upgrade issues with ownership of large objects

2012-12-16 Thread Tom Lane
David Wall writes: > In past PG upgrades, we've done a pg_dump on the current version, then a > pg_restore on the new version. But during the 8.4 to 9.2 upgrade (on > Linux x64), we ran into issues with the permissions associated with the > large objects after the restore. Large objects didn'

Re: [GENERAL] Problems with a custom LOCALE

2012-12-16 Thread James B. Byrne
On Fri, December 14, 2012 17:40, Tom Lane wrote: > "James B. Byrne" writes: >> PG::Error: ERROR: encoding "UTF8" does not match locale >> "en...@-mmm-dd.utf-8" >> DETAIL: The chosen LC_CTYPE setting requires encoding "LATIN1". >> : CREATE DATABASE "hll_th_forex_test" ENCODING = 'UTF8' TEMPL

Re: [GENERAL] Problems with a custom LOCALE

2012-12-16 Thread Tom Lane
"James B. Byrne" writes: >>> PG::Error: ERROR: encoding "UTF8" does not match locale >>> "en...@-mmm-dd.utf-8" >>> DETAIL: The chosen LC_CTYPE setting requires encoding "LATIN1". > This is what I see on the host running postgresql-9.2 > # LC_ALL=en_CA@-mmm-dd.utf8 locale charmap > UTF-8

Re: [GENERAL] Authenticate with hash instead of plaintext password?

2012-12-16 Thread Peter Bex
On Sun, Dec 16, 2012 at 11:17:25AM -0800, Adrian Klaver wrote: > On 12/16/2012 11:07 AM, Peter Bex wrote: > > I don't know how Postgres stores its passwords internally or how > > its authentication works exactly. Maybe one of the developers > > can shine a light on this. > > http://www.postgresql

Re: [GENERAL] Default timezone changes in 9.1

2012-12-16 Thread Terence Ferraro
On Sun, Dec 16, 2012 at 1:16 PM, Tom Lane wrote: > Andres Freund writes: > > On 2012-12-16 12:25:13 -0500, Tom Lane wrote: > >> I'm still not sure what > >> the OP actually wants to accomplish by moving the time of making the > >> choice. > > > I guess he wants - and I have seen that before - to

Re: [GENERAL] PgAdmin question (maybe off topic)

2012-12-16 Thread Guillaume Lelarge
On Tue, 2012-12-11 at 18:13 -0200, Edson Richter wrote: > Dear list, > > When using PgAdmin on Windows 7 (64bit), sometimes I can manage indexes, > sometimes cannot. > Example (can manage indexes normally): > > > > > Cannot manage indexes at all: > > > > Must be something related to the ta

Re: [GENERAL] XML Schema for PostgreSQL database

2012-12-16 Thread Guillaume Lelarge
On Fri, 2012-12-14 at 14:17 -0200, Edson Richter wrote: > Em 14/12/2012 12:21, Merlin Moncure escreveu: > > On Thu, Dec 13, 2012 at 5:52 PM, Edson Richter > > wrote: > >> Em 13/12/2012 20:10, Merlin Moncure escreveu: > >>[...] > > > *) diagram output should be standard html (only) without requir

Re: [GENERAL] Need help for import of text file

2012-12-16 Thread Steve Clark
On 12/16/2012 01:12 PM, Peter Bex wrote: On Sun, Dec 16, 2012 at 06:48:35PM +0100, Andreas wrote: With sed as startingpoint I figured it out. Those 3 steps make the input files consumable for COPY 1. dos2unix 2. sed -i 's/[ \t]*$//' 3. sed -i 's/ / /g' You can reduce this to one invocation by

Re: [GENERAL] Need help for import of text file

2012-12-16 Thread Peter Bex
On Sun, Dec 16, 2012 at 06:30:24PM -0500, Steve Clark wrote: > why not use the squeeze option of tr. > > tr -s " " I wasn't aware of that one, it's even simpler and more elegant. Thanks! For this particular case, tr(1) won't do for the same reason the simple sed(1) expression I gave won't do: it

Re: [GENERAL] XML Schema for PostgreSQL database

2012-12-16 Thread Edson Richter
Em 16/12/2012 20:27, Guillaume Lelarge escreveu: On Fri, 2012-12-14 at 14:17 -0200, Edson Richter wrote: Em 14/12/2012 12:21, Merlin Moncure escreveu: On Thu, Dec 13, 2012 at 5:52 PM, Edson Richter wrote: Em 13/12/2012 20:10, Merlin Moncure escreveu: [...] *) diagram output should be standar

Re: [GENERAL] PG 8.4 to 9.2 upgrade issues with ownership of large objects

2012-12-16 Thread David Wall
On 12/16/2012 11:22 AM, Tom Lane wrote: David Wall writes: In past PG upgrades, we've done a pg_dump on the current version, then a pg_restore on the new version. But during the 8.4 to 9.2 upgrade (on Linux x64), we ran into issues with the permissions associated with the large objects after

Re: [GENERAL] Authenticate with hash instead of plaintext password?

2012-12-16 Thread Stephen Frost
* Murray Cumming (murr...@murrayc.com) wrote: > I do have the option of creating a different set of user/password logins > for the web UI and then either > - Using one username/password for all web users' databases, with no > PostgreSQL-level separation. But this would have to be in a config fi

Re: [GENERAL] Authenticate with hash instead of plaintext password?

2012-12-16 Thread Stephen Frost
* Peter Bex (peter@xs4all.nl) wrote: > Hm, that's a good point, I hadn't considered that. I don't know how > Postgres stores its passwords internally or how its authentication works > exactly. Maybe one of the developers can shine a light on this. PG stores a hash which is salted with the us

Re: [GENERAL] Authenticate with hash instead of plaintext password?

2012-12-16 Thread Stephen Frost
* Peter Bex (peter@xs4all.nl) wrote: > I could try my hand at providing a patch to switch to, say, bcrypt, > but I'm pretty unfamiliar with the PostgreSQL source code. If > nobody else is interested in working on it I can give it a try > during the holidays. The code, in general, is very clea

Re: [GENERAL] PG 8.4 to 9.2 upgrade issues with ownership of large objects

2012-12-16 Thread Tom Lane
David Wall writes: > On 12/16/2012 11:22 AM, Tom Lane wrote: >> Large objects didn't have privileges, nor owners, in 8.4. If you don't >> feel like fixing your apps right now, you can return to the previous >> behavior by setting the obscurely-named lo_compat_privileges setting in >> postgresql.c

Re: [GENERAL] Need help for import of text file

2012-12-16 Thread Sheraz Sharif
On Dec 15, 2012, at 1:06 PM, Andreas wrote: > Hi, > > I need to import textfiles that have 5 columns but there is just blanks as > delimitors. > I could use COPY to read them but there is a time column that shows times as > " h:mm.ss,ms" in the morning and "hh:mm.ss,ms" in the afternoon. > > P

[GENERAL] initdb error

2012-12-16 Thread David Noel
I'm running into the following error message when running initdb (FreeBSD host): ygg# /usr/local/etc/rc.d/postgresql initdb -D /zdb/pgsql/data --debug The files belonging to this database system will be owned by user "pgsql". This user must also own the server process. The database cluster wi

[GENERAL] problem with large inserts

2012-12-16 Thread Lutz Fischer
Hi I have currently some trouble with inserts into a table INSERT INTO LPP (PPID, LID) SELECT DISTINCT PPid, LID FROM (SELECT * FROM PP WHERE s_id = sid) pp INNER JOIN has_protein hp1 ON pp.p1id = hp1.pid INNER JOIN has_protein hp2

Re: [GENERAL] large database

2012-12-16 Thread Nathan Clayton
On Dec 11, 2012 2:25 PM, "Adrian Klaver" wrote: > > On 12/11/2012 01:58 PM, Mihai Popa wrote: >> >> On Tue, 2012-12-11 at 10:00 -0800, Jeff Janes wrote: >>> >>> On Mon, Dec 10, 2012 at 12:26 PM, Mihai Popa wrote: Hi, I've recently inherited a project that involves importing a

Re: [GENERAL] Looking for cooperators

2012-12-16 Thread Fan, Yi
Hi Merlin, Thanks so much for your points. I am not quite familiar with each of those lists, just want to broadcast a message. For our product, actually, we are doing the both way. We added some facility functions into PostgreSQL make it become a customized product which is free. And charge prof

Re: [GENERAL] Error in installing Postgre SQL

2012-12-16 Thread Atri Sharma
On Tue, Dec 11, 2012 at 6:37 PM, Rajesh Aldarthi wrote: > Dear all, > > I'm getting this below error while installing postgre sql. I have tried > most of versions available online. > > > > > When i continue, i'm unable to connect the sever. > > Please help > > -- ** > The error message? Atri