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

2011-10-11 Thread Alban Hertroys
On 11 Oct 2011, at 2:55, Harvey, Allan AC wrote: 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. I think you may be right there, something about the rounding in

Re: [GENERAL] SQL Help - Finding Next Lowest Value of Current Row Value

2011-10-11 Thread Jeff Adams
Thanks for the suggestions Chris (and Chris). After a bit more investigation I stumbled upon the Window functions. The approach below turned out to be much more efficient that a function or self join approach. The SQL that I used is provided below (event_id and mmsi uniquely identify a vessel

[GENERAL] Question on GiST re-index

2011-10-11 Thread Krishnanand Gopinathan Sathikumari
Hi All, I am trying to upgrade my postgres server from 8.3.3 to 8.3.15. Postgres 8.3.15 has a dependency on 8.3.8 and this has a dependency on 8.3.5. *.3.5 states to reindex all GiST indexes after the upgrade. Also 8.3.8 states 'fix hash calculation for data type 'interval'. Will these

[GENERAL] Global Variables?

2011-10-11 Thread Eric Radman
When writing unit tests it's sometimes useful to stub functions such as the current date and time -- define mock functions CREATE OR REPLACE FUNCTION _now() RETURNS timestamp with time zone AS $$ BEGIN RETURN '2011-10-10 10:00'; END; $$ LANGUAGE plpgsql; -- define tables accounts CREATE TABLE

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

2011-10-11 Thread Tom Lane
Alban Hertroys haram...@gmail.com writes: On 11 Oct 2011, at 2:55, Harvey, Allan AC wrote: My simple understanding of trunc() and casting to an integer says that there is a bug here. Which the type-cast should round to 4380103 and 4380104 respectively. It doesn't: That's because a cast from

Re: [GENERAL] Global Variables?

2011-10-11 Thread Alban Hertroys
On 11 October 2011 16:06, Eric Radman ericsh...@eradman.com wrote: When writing unit tests it's sometimes useful to stub functions such as the current date and time Is it possible to declare a global variable that can be referenced from the user-defined function _now()? I'm looking for a

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

2011-10-11 Thread Alban Hertroys
On 11 October 2011 15:41, Tom Lane t...@sss.pgh.pa.us wrote: Alban Hertroys haram...@gmail.com writes: On 11 Oct 2011, at 2:55, Harvey, Allan AC wrote: My simple understanding of trunc() and casting to an integer says that there is a bug here. Which the type-cast should round to 4380103 and

Re: [GENERAL] [postgis-users] Query slow down, never completes

2011-10-11 Thread Sandro Santilli
On Tue, Oct 11, 2011 at 02:25:20PM +0200, Andreas Forø Tollefsen wrote: I also tried to close the db1 connection for each year in the loop, and reopen the connection for the next year in the loop. Same problem. I have tried both with insert into ... select .. and select into annual tables and

Re: [GENERAL] Global Variables?

2011-10-11 Thread Achilleas Mantzios
It would be interesting if the parameters/settings framework could be extended to provide session/table/user/database level custom settings, accessible via the SET/SHOW/RESET commands. Is there anything like this ever been considered/discussed ? Στις Tuesday 11 October 2011 17:06:50 ο/η Eric

Re: [GENERAL] [postgis-users] Query slow down, never completes

2011-10-11 Thread Andreas Forø Tollefsen
Hi Sandro, What i find strange is that it stops processing at different years on my desktop and my laptop. While my desktop stops processing at 1980, my slower laptop goes on to 1991 before halting. I also tried with different postgresql.conf shared_buffers settings without making any difference.

Re: [GENERAL] [postgis-users] Query slow down, never completes

2011-10-11 Thread Sandro Santilli
On Tue, Oct 11, 2011 at 05:12:24PM +0200, Andreas Forø Tollefsen wrote: Hi Sandro, What i find strange is that it stops processing at different years on my desktop and my laptop. While my desktop stops processing at 1980, my slower laptop goes on to 1991 before halting. I also tried with

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

2011-10-11 Thread Tom Lane
Alban Hertroys haram...@gmail.com writes: On 11 October 2011 15:41, Tom Lane t...@sss.pgh.pa.us wrote: That's because a cast from float to int rounds, it doesn't truncate. I figured it would be something like that. Is that how it's defined in the SQL standard? SQL99 says Whenever

Re: [GENERAL] Logging queries cancelled due to replication timeouts

2011-10-11 Thread Bruce Momjian
Christophe Pettus wrote: 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)? Sure, how about the system view pg_stat_database_conflicts in PG 9.1? Our docs say:

[GENERAL] libpq 8.3 and 8.4 interfaces

2011-10-11 Thread salah jubeh
Hello, Could someone point me,  where I can find the difference between libpq 8.3 and 8.4, I have seen the new features of the 8.4, but I want to know  about the API interface changes  Thanks in advance 

Re: [GENERAL] libpq 8.3 and 8.4 interfaces

2011-10-11 Thread John R Pierce
On 10/11/11 12:42 PM, salah jubeh wrote: Could someone point me, where I can find the difference between libpq 8.3 and 8.4, I have seen the new features of the 8.4, but I want to know about the API interface changes open http://www.postgresql.org/docs/8.4/static/libpq.html and

Re: [GENERAL] Global Variables?

2011-10-11 Thread Eric Radman
On Tue, Oct 11, 2011 at 04:26:47PM +0200, Alban Hertroys wrote: On 11 October 2011 16:06, Eric Radman ericsh...@eradman.com wrote: When writing unit tests it's sometimes useful to stub functions such as the current date and time You could create a table for such constants and read your

[GENERAL] how to call a stored function from another stored function? even possible?

2011-10-11 Thread Java Services
I have a stored functionA that returns void Inside there I have a line that says: select functionB(); and it gives this error. ERROR: query has no destination for result data HINT: If you want to discard the results of a SELECT, use PERFORM instead. CONTEXT: PL/pgSQL function functionA

Re: [GENERAL] libpq 8.3 and 8.4 interfaces

2011-10-11 Thread salah jubeh
Thanks for the quick support   Best Regard From: John R Pierce pie...@hogranch.com To: pgsql-general@postgresql.org Sent: Tuesday, October 11, 2011 9:52 PM Subject: Re: [GENERAL] libpq 8.3 and 8.4 interfaces On 10/11/11 12:42 PM, salah jubeh wrote: Could

Re: [GENERAL] libpq 8.3 and 8.4 interfaces

2011-10-11 Thread Bruce Momjian
John R Pierce wrote: On 10/11/11 12:42 PM, salah jubeh wrote: Could someone point me, where I can find the difference between libpq 8.3 and 8.4, I have seen the new features of the 8.4, but I want to know about the API interface changes open

Re: [GENERAL] how to call a stored function from another stored function? even possible?

2011-10-11 Thread David Johnston
On Oct 11, 2011, at 15:54, Java Services jvsr...@gmail.com wrote: I have a stored functionA that returns void Inside there I have a line that says: select functionB(); and it gives this error. ERROR: query has no destination for result data HINT: If you want to discard the

Re: [GENERAL] libpq 8.3 and 8.4 interfaces

2011-10-11 Thread salah jubeh
Hello Bruce, Nothing is missing,  I was looking for a summary of what has changed in libpq. But certainly the links are more than helpful. Thanks again for the quick response  Regards     From: Bruce Momjian br...@momjian.us To: John R Pierce

[GENERAL] how to save primary key constraints

2011-10-11 Thread J.V.
I need to be able to query for all primary keys and save the table name and the name of the primary key field into some structure that I can iterate through later. How would I go about this? I want to hard code the number of tables and be able to iterate through some structure to get the

Re: [GENERAL] how to call a stored function from another stored function? even possible?

2011-10-11 Thread Raymond O'Donnell
On 11/10/2011 20:54, Java Services wrote: I have a stored functionA that returns void Inside there I have a line that says: select functionB(); and it gives this error. ERROR: query has no destination for result data HINT: If you want to discard the results of a SELECT, use

Re: [GENERAL] how to save primary key constraints

2011-10-11 Thread John R Pierce
On 10/11/11 2:16 PM, J.V. wrote: I need to be able to query for all primary keys and save the table name and the name of the primary key field into some structure that I can iterate through later. How would I go about this? I want to hard code the number of tables and be able to iterate

Re: [GENERAL] libpq 8.3 and 8.4 interfaces

2011-10-11 Thread Merlin Moncure
On Tue, Oct 11, 2011 at 3:03 PM, salah jubeh s_ju...@yahoo.com wrote: Hello Bruce, Nothing is missing,  I was looking for a summary of what has changed in libpq. But certainly the links are more than helpful. Thanks again for the quick response Regards another great place to get a bird's eye

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

2011-10-11 Thread Harvey, Allan AC
-Original Message- From: Alban Hertroys [mailto:haram...@gmail.com] Sent: Wednesday, 12 October 2011 1:35 AM To: Tom Lane Cc: Harvey, Allan AC; pgsql-general@postgresql.org Subject: Re: [GENERAL] Should casting to integer produce same result as trunc() On 11 October 2011 15:41,

Re: [GENERAL] how to save primary key constraints

2011-10-11 Thread Joe Abbate
On 10/11/2011 05:16 PM, J.V. wrote: I need to be able to query for all primary keys and save the table name and the name of the primary key field into some structure that I can iterate through later. How would I go about this? I want to hard code the number of tables and be able to iterate

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

2011-10-11 Thread Sean Laurent
On Mon, Oct 10, 2011 at 8:09 AM, Craig Ringer ring...@ringerc.id.au wrote: 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

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

2011-10-11 Thread Sean Laurent
On Fri, Oct 7, 2011 at 12:36 AM, Tom Lane t...@sss.pgh.pa.us wrote: Sean Laurent s...@studyblue.com writes: 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

[GENERAL] how to find primary key field name?

2011-10-11 Thread J.V.
If I have a table name, I know how to find the primary key constraint name, but see no way to find the primary key field name. select constraint_name from information_schema.tabale_constraints where table_name = table_name and constraint_type = 'PRIMARY KEY'; will return the constraint name,

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

2011-10-11 Thread Sean Laurent
On Tue, Oct 11, 2011 at 12:04 AM, Craig Ringer ring...@ringerc.id.au wrote: 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

Re: [GENERAL] how to find primary key field name?

2011-10-11 Thread Adrian Klaver
On Tuesday, October 11, 2011 3:54:09 pm J.V. wrote: If I have a table name, I know how to find the primary key constraint name, but see no way to find the primary key field name. select constraint_name from information_schema.tabale_constraints where table_name = table_name and

Re: [GENERAL] how to find primary key field name?

2011-10-11 Thread Joe Abbate
On 10/11/2011 06:54 PM, J.V. wrote: If I have a table name, I know how to find the primary key constraint name, but see no way to find the primary key field name. select constraint_name from information_schema.tabale_constraints where table_name = table_name and constraint_type = 'PRIMARY

Re: [GENERAL] how to save primary key constraints

2011-10-11 Thread J.V.
pg_catalog table does not exist. This is a solution for PostgreSQL 8.4. If you know of a way I can get all primary key fields or have a query that will work in 8.4, please help. I have done a lot of research and cannot find a simple way. J.V. On 10/11/2011 3:29 PM, John R Pierce wrote:

Re: [GENERAL] how to save primary key constraints

2011-10-11 Thread Raymond O'Donnell
On 12/10/2011 00:24, J.V. wrote: pg_catalog table does not exist. It's not a table, it's PostgreSQL's version of the information_schema catalog: http://www.postgresql.org/docs/8.4/static/catalogs.html Ray. -- Raymond O'Donnell :: Galway :: Ireland r...@iol.ie -- Sent via pgsql-general

Re: [GENERAL] how to save primary key constraints

2011-10-11 Thread Chris Travers
On Tue, Oct 11, 2011 at 4:33 PM, Raymond O'Donnell r...@iol.ie wrote: On 12/10/2011 00:24, J.V. wrote: pg_catalog table does not exist. It's not a table, it's PostgreSQL's version of the information_schema catalog:  http://www.postgresql.org/docs/8.4/static/catalogs.html Not quite.

Re: [GENERAL] how to save primary key constraints

2011-10-11 Thread John R Pierce
On 10/11/11 4:24 PM, J.V. wrote: pg_catalog table does not exist. This is a solution for PostgreSQL 8.4. pg_catalog is a schema that has about 150 views and tables in it. pg_tables is one such, as is pg_indexes (these two are both views) you do realize, the primary key might not BE a

Re: [GENERAL] how to find primary key field name?

2011-10-11 Thread Stephen Cook
On 10/11/2011 6:54 PM, J.V. wrote: If I have a table name, I know how to find the primary key constraint name, but see no way to find the primary key field name. SELECT t.table_catalog, t.table_schema, t.table_name, kcu.constraint_name, kcu.column_name,

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

2011-10-11 Thread Scott Marlowe
On Tue, Oct 11, 2011 at 5:00 PM, Sean Laurent s...@studyblue.com wrote: As much as I would like Postgres to withstand a 2 second outage, I don't honestly care. I'd just like to figure out whether I'm looking at something that's actually a problem or if I should be looking elsewhere for the

Re: [GENERAL] 7

2011-10-11 Thread Scott Ribe
On Oct 11, 2011, at 8:18 PM, The Great SunWuKung wrote: This shop is number 1 at my shop-list! So why the fuck is your spam title 7??? -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice -- Sent via pgsql-general mailing list

[GENERAL] Drill-downs and OLAP type data

2011-10-11 Thread Anthony Presley
Hi there! We have a typical data-warehouse type application, and we'd like to set up a star-schema type data analysis software product (which we'll be programming), on top of PG. The goal is to do fast roll-up, drill-down, and drill-through of objects / tables like locations, inventory items,

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

2011-10-11 Thread Sean Laurent
On Tue, Oct 11, 2011 at 8:50 PM, Scott Marlowe scott.marl...@gmail.com wrote: On Tue, Oct 11, 2011 at 5:00 PM, Sean Laurent s...@studyblue.com wrote: As much as I would like Postgres to withstand a 2 second outage, I don't honestly care. I'd just like to figure out whether I'm looking at

Re: [GENERAL] how to save primary key constraints

2011-10-11 Thread Ondrej Ivanič
Hi, On 12 October 2011 08:16, J.V. jvsr...@gmail.com wrote: I need to be able to query for all primary keys and save the table name and the name of the primary key field into some structure that I can iterate through later. psql -E is your friend here. Then use \d table and you get several

[GENERAL] Question on GiST re-index

2011-10-11 Thread Krishnanand Gopinathan Sathikumari
Hi All, I am trying to upgrade my postgres server from 8.3.3 to 8.3.15. Postgres 8.3.15 has a dependency on 8.3.8 and this has a dependency on 8.3.5. *.3.5 states to reindex all GiST indexes after the upgrade. Also 8.3.8 states 'fix hash calculation for data type 'interval'. Will these

[GENERAL] I need to load mysql dump to postgres...

2011-10-11 Thread unclebob
good noon, subj. I don't want to load dump to mysql etc... Is there a program which would just parse mysql dump file and load data to postgresql using plain sql inserts? thanks. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] I need to load mysql dump to postgres...

2011-10-11 Thread Craig Ringer
On 10/12/2011 10:37 AM, unclebob wrote: good noon, subj. I don't want to load dump to mysql etc... Is there a program which would just parse mysql dump file and load data to postgresql using plain sql inserts? There's no single, simple automatic migration tool. Numerous tools exist to help.

Re: [GENERAL] Drill-downs and OLAP type data

2011-10-11 Thread Craig Ringer
On 10/12/2011 11:50 AM, Anthony Presley wrote: What's the PG route here? Are there some secrets / tips / tricks / contrib modules for handling this? I don't see much discussion of DW, OLAP-type workloads here. Pg doesn't support index-oriented tables (though IIRC 9.2 will add covering

Re: [GENERAL] 7

2011-10-11 Thread Stephen Cook
On 10/11/2011 11:34 PM, Scott Ribe wrote: On Oct 11, 2011, at 8:18 PM, The Great SunWuKung wrote: This shop is number 1 at my shop-list! So why the fuck is your spam title 7??? Because 1 through 6 already get caught as SPAM? -- Sent via pgsql-general mailing list

Re: [GENERAL] Drill-downs and OLAP type data

2011-10-11 Thread Filip Rembiałkowski
Mondrian (which is a part of Pentaho BI stack) is an open source OLAP engine with MDX. See http://community.pentaho.com/projects/bi_platform/ 2011/10/12 Anthony Presley anth...@resolution.com Hi there! We have a typical data-warehouse type application, and we'd like to set up a star-schema