[GENERAL] aggregate over tables in different schema

2010-01-09 Thread Ivan Sergio Borgonovo
I've tables in different schemas all with the same name and structure. I'd like to compute an aggregate on the union of those tables. I don't know the schemas in advance. The list of the schema will be built selecting all the schemas that contain a table with that name. Other than building dynamic

Re: [GENERAL] dynamic insert in plpgsql

2010-01-09 Thread Grzegorz Jaśkiewicz
This is what I hacked quickly last night, what you guys think? CREATE OR REPLACE FUNCTION something.ziew_partition_insert() RETURNS TRIGGER AS $_$ DECLARE partition_table_name varchar; old_partition_table_name varchar; BEGIN SELECT 'something_partitions.ziew_'||to_char(NEW.logtime, 'IYYY_MM

Re: [GENERAL] Gentoo, 8,2 ---> 8.4, and /var/run/postgresql in mode 770

2010-01-09 Thread Greg Smith
fe...@crowfix.com wrote: Everything went smoothly except the permissions of the directory /var/run/postgresql with the domain socket .s.PGSQL.5432. This dir had permissions of 770, owned by postgres.postgres, so no mere mortals could access it. I have changed this to 775 and can now access it.

Re: [GENERAL] Gentoo, 8,2 ---> 8.4, and /var/run/postgresql in mode 770

2010-01-09 Thread felix
On Sat, Jan 09, 2010 at 11:18:19PM +0100, Leif Biberg Kristensen wrote: > In Gentoo, you must add the database owner (probably your own username) to > the > group Postgres. This was changed with 8.3, and if you had read the message > from emerge, you should have noticed. And, yes, I fumbled a l

Re: [GENERAL] dynamic insert in plpgsql

2010-01-09 Thread Merlin Moncure
2010/1/9 Dimitri Fontaine : > Grzegorz Jaśkiewicz writes: > >> Is there any nice way to do something like that in plpgsql: >> >>   EXECUTE 'INSERT INTO '||partition_table_name||' VALUES'||(NEW.*)||''; > > See http://wiki.postgresql.org/wiki/PL/pgSQL_Dynamic_Triggers > -- that approach is awful.

Re: [GENERAL] Gentoo, 8,2 ---> 8.4, and /var/run/postgresql in mode 770

2010-01-09 Thread Leif Biberg Kristensen
On Saturday 9. January 2010 22.20.36 fe...@crowfix.com wrote: > I just upgraded my home gentoo system's postgresql from 8.2.14 to > 8.4.2. I use it mostly for fooling around and keeping smatterings of > personal data, so it was simple laziness which kept me from upgrading > sooner, triggered by th

Re: [GENERAL] An issue with max() and order by ... limit 1 in postgresql8.3-beta3

2010-01-09 Thread Scott Marlowe
On Sat, Jan 9, 2010 at 2:46 PM, Andreas Kretschmer wrote: > Stefan Kaltenbrunner wrote: > >> Andreas Kretschmer wrote: >>> zxo102 ouyang wrote: >>> Hi everyone,    I am using postgresql 8.3-beta3. I have a table 'test' with three fields: >>> >>> I'm guessing you mean 8.4-beta3, right?

Re: [GENERAL] Gentoo, 8,2 ---> 8.4, and /var/run/postgresql in mode 770

2010-01-09 Thread Scott Marlowe
On Sat, Jan 9, 2010 at 2:20 PM, wrote: > I just upgraded my home gentoo system's postgresql from 8.2.14 to > 8.4.2.  I use it mostly for fooling around and keeping smatterings of > personal data, so it was simple laziness which kept me from upgrading > sooner, triggered by the gentoo switch back

Re: [GENERAL] dynamic insert in plpgsql

2010-01-09 Thread Dimitri Fontaine
Grzegorz Jaśkiewicz writes: > Is there any nice way to do something like that in plpgsql: > > EXECUTE 'INSERT INTO '||partition_table_name||' VALUES'||(NEW.*)||''; See http://wiki.postgresql.org/wiki/PL/pgSQL_Dynamic_Triggers -- dim -- Sent via pgsql-general mailing list (pgsql-general@post

Re: [GENERAL] An issue with max() and order by ... limit 1 in postgresql8.3-beta3

2010-01-09 Thread Andreas Kretschmer
Stefan Kaltenbrunner wrote: > Andreas Kretschmer wrote: >> zxo102 ouyang wrote: >> >>> Hi everyone,I am using postgresql 8.3-beta3. I have a table >>> 'test' with three fields: >> >> I'm guessing you mean 8.4-beta3, right? > > either of those are unsuitable for any kind of production use...

Re: [GENERAL] Table appears on listing but can't drop it

2010-01-09 Thread hubert depesz lubaczewski
On Fri, Jan 08, 2010 at 02:39:03PM -0200, Fernando Morgenstern wrote: > postgres=# drop database skynet; > ERROR: database "skynet" does not exist do: psql -l | hexump -C and examine output. Best regards, depesz -- Linkedin: http://www.linkedin.com/in/depesz / blog: http://www.depesz.com/

[GENERAL] Gentoo, 8,2 ---> 8.4, and /var/run/postgresql in mode 770

2010-01-09 Thread felix
I just upgraded my home gentoo system's postgresql from 8.2.14 to 8.4.2. I use it mostly for fooling around and keeping smatterings of personal data, so it was simple laziness which kept me from upgrading sooner, triggered by the gentoo switch back in 8.2.mumble in how they manage postgresql. Eve

Re: [GENERAL] An issue with max() and order by ... limit 1 in postgresql8.3-beta3

2010-01-09 Thread Stefan Kaltenbrunner
Andreas Kretschmer wrote: zxo102 ouyang wrote: Hi everyone, I am using postgresql 8.3-beta3. I have a table 'test' with three fields: I'm guessing you mean 8.4-beta3, right? either of those are unsuitable for any kind of production use... Stefan -- Sent via pgsql-general mailing lis

Re: [GENERAL] An issue with max() and order by ... limit 1 in postgresql8.3-beta3

2010-01-09 Thread Andreas Kretschmer
zxo102 ouyang wrote: > Hi everyone, >I am using postgresql 8.3-beta3. I have a table 'test' with three fields: I'm guessing you mean 8.4-beta3, right? > Any suggestions for the best way to get maximum data value and corresponding > "time" for each group of sid in my case? Based on your d

Re: [GENERAL] Table appears on listing but can't drop it

2010-01-09 Thread Tom Lane
Rikard Bosnjakovic writes: > Is there a particular reason space is allowed in name identifiers? I > see nothing but confusion if a space exists. The SQL standard requires that double-quoted identifiers be allowed to contain anything. regards, tom lane -- Sent via pgsql-

Re: [GENERAL] An issue with max() and order by ... limit 1 in postgresql8.3-beta3

2010-01-09 Thread Raymond O'Donnell
On 09/01/2010 16:43, zxo102 ouyang wrote: > Hi everyone, >I am using postgresql 8.3-beta3. I have a table 'test' with three fields: Without meaning to sound unhelpful, why on earth are you using a beta version when 8.3 was released *ages* ago and has had several bug-fix updates since? I'd lo

[GENERAL] An issue with max() and order by ... limit 1 in postgresql8.3-beta3

2010-01-09 Thread zxo102 ouyang
Hi everyone, I am using postgresql 8.3-beta3. I have a table 'test' with three fields: sid data date 11.1 2009-09-01 1:00:00 12.1 2010-01-01 1:00:20 23.1 2009-09-01 1:00:10

Re: [GENERAL] set-level update fails with unique constraint violation

2010-01-09 Thread Tom Lane
"Daniel Verite" writes: > Tom Lane wrote: >> 1. Performance. The cost of #2 is very large, and the number of cases >> where you actually need it is not. > Per Dean's explanation upthread, It looks like an additional cost for #2 > would occur mostly when temporary conflicts occur, that is,

Re: [GENERAL] WAL Log Shipping - Warm Standby not working under 8.3.7

2010-01-09 Thread Keaton Adams
We are still on PG 8.3.7 and I don't see pg_standby. It looks like it was added with 8.3.8. I will put in a request to update to 8.3.9 as a part of our next software upgrade (internal product we write) but for now I need to try to figure out why this isn't working under 8.3.7. I did manage t

Re: [GENERAL] pgsql2shp usage

2010-01-09 Thread Randall Thompson
The Attribute Tables for a shape file is stored in .DBF format which has a restriction that field names are only ten characters long, so the warnings are simply informing you that those field names that are longer than 10 characters are being truncated. The projection definition indicates that the

Re: [GENERAL] Server name in psql prompt

2010-01-09 Thread Mark Morgan Lloyd
Mark Morgan Lloyd wrote: I thought earlier that I could use finger as a hack for querying the server, i.e. I could put e.g. a disc set name in /home/postgres/.plan. However I then realised that I'd need %M to be expanded before %`, so that I could do something like \set PROMPT1 '`finger postg

Re: [GENERAL] set-level update fails with unique constraint violation

2010-01-09 Thread Daniel Verite
Tom Lane wrote: > "Daniel Verite" writes: > > But still I wonder why there is that difference in behavior between NON > > DEFERRABLE and DEFERRABLE INITIALLY IMMEDIATE, when the unique constraint > > doesn't get deferred by using SET CONSTRAINTS. > > In the first case, we get the "after e

Re: [GENERAL] Table appears on listing but can't drop it

2010-01-09 Thread Rikard Bosnjakovic
On Fri, Jan 8, 2010 at 17:44, Sam Mason wrote: > There's an extra space at the beginning of the "skynet" line, could it Is there a particular reason space is allowed in name identifiers? I see nothing but confusion if a space exists. -- - Rikard - http://bos.hack.org/cv/ -- Sent via pgsql-g

Re: [GENERAL] pgadmin save password

2010-01-09 Thread José María Terry Jiménez
glaucomag escribió: Hi, I've a problem with pgadmin. If I access to database with user X and I save password, when I access to database from shell (psql) password is not required. Of course pg_hba.conf is: local database X md5 If I don't save password in pgadmin, it's ok (psql required password

[GENERAL] PL/Python flattens composite types to string?

2010-01-09 Thread Steve White
Hi, I recently wrote PL/Python code that worked on fields of composite types. The plpy.execute() command on a SELECT returns a list of nice dictionaries keyed on field names, containing the fields. For numeric types, the type of the dictionary values are as expected. To my chagrin however, if a

[GENERAL] pgsql2shp usage

2010-01-09 Thread Anisha Kaul
Hello to all, I downloaded an OSM map file namely "india.osm.bz2". I transported it in PostgreSQL database "gis" with the command : ./osm2pgsql -m -d gis india.osm.bz2 The above command resulted in the creation of the following tables filled with data in database "gis" gis=# \d