[GENERAL] Dynamic/polymorphic record/composite return types for C user-defined-functions

2013-04-02 Thread Stephen Scheck
Hi, I'm trying to write some user-defined functions in C which operate on a large object (so their common first argument will be an OID referencing an object in the pg_largeobject catalog table created with lo_create()) and return either a single row or a set depending on the function. Depending

Re: [GENERAL] Money casting too liberal?

2013-04-02 Thread Gavin Flower
On 29/03/13 12:39, Jasen Betts wrote: On 2013-03-28, Gavin Flower gavinflo...@archidevsys.co.nz wrote: Hmm... This should optionally apply to time. e.g. time_i_got_up_in_the_morning should reflect the time zone where I got up - if I got up at 8am NZ time then this should be displayed, not 12pm

Re: [GENERAL] Money casting too liberal?

2013-04-02 Thread Gavin Flower
On 30/03/13 04:08, Gavan Schneider wrote: Some thoughts. The current MONEY type might be considered akin to ASCII. Perfect for a base US centric accounting system where there are cents and dollars and no need to carry smaller fractions. As discussed, there are some details that could be

Re: [GENERAL] Money casting too liberal?

2013-04-02 Thread Gavin Flower
On 30/03/13 11:30, Gavan Schneider wrote: On 29/3/13 at 3:32 AM, D'Arcy J.M. Cain wrote: On Fri, 29 Mar 2013 11:46:40 -0400 Tom Lane wrote: Well, this has been discussed before, and the majority view every time has been that MONEY is a legacy thing that most people would rather rip out than

Re: [GENERAL] Money casting too liberal?

2013-04-02 Thread Gavin Flower
On 30/03/13 08:36, Michael Nolan wrote: On 3/27/13, Steve Crawford scrawf...@pinpointresearch.com wrote: Somewhat more worrisome is the fact that it automatically rounds input (away from zero) to fit. select '123.456789'::money; money - $123.46 So does casting to an integer:

Re: [GENERAL] Problem with pg_basebackup and streaming replication. (9.2.3 / win64)

2013-04-02 Thread Tore Halvorsen
Ah, this was related to file permissions. The service is running as NETWORK SERVICE, but this user didn't have access to the tablespace-directory. On Mon, Apr 1, 2013 at 3:14 PM, Adrian Klaver adrian.kla...@gmail.comwrote: On 03/31/2013 04:47 PM, Tore Halvorsen wrote: Good idea, but both

[GENERAL] sql text

2013-04-02 Thread Ray Stell
Forwarding a post seen on an oracle list this morning as Stephane has been quite an inspiration over the years and he is covering postgresql in this text: Some list members may be adjunct or full-time faculty members and interested by the fact that I'm currently working on a 450-page

[GENERAL] create temporary table problem

2013-04-02 Thread JPrasanna Venkatesan
Dear All, I am usnig PGSQL 9.0 When I tried to create a temporary table it is throwing the following error ERROR: could not create directory pg_tblspc/16385/PG_9.0_201008051/20304: No such file or directory Whole snippet is like this ctfdb= create temporary table assoc ( origin varchar(32),

Re: [GENERAL] Trigger of Transaction

2013-04-02 Thread Joe Van Dyk
On Mon, Apr 1, 2013 at 8:41 PM, Juan Pablo Cook juamp...@gmail.com wrote: Hi everyone! I need your help with this problem. I'm using PostgreSQL *9.2 Server* the latest jdbc driver: postgresql-9.2-1002.jdbc4.jar I have a many to one relation. I have this piece of code:

Re: [GENERAL] Using varchar primary keys.

2013-04-02 Thread Joe Van Dyk
On Mon, Apr 1, 2013 at 1:11 PM, Tim Uckun timuc...@gmail.com wrote: On Tue, Apr 2, 2013 at 8:35 AM, jesusthefrog jesusthef...@gmail.comwrote: On the topic of 'natural' versus 'synthetic' primary keys, I am generally in the camp that an extra ID field won't cost you too much, and while one

Re: [GENERAL] Dynamic/polymorphic record/composite return types for C user-defined-functions

2013-04-02 Thread Tom Lane
Stephen Scheck singularsyn...@gmail.com writes: I'm trying to write some user-defined functions in C which operate on a large object (so their common first argument will be an OID referencing an object in the pg_largeobject catalog table created with lo_create()) and return either a single row

Re: [GENERAL] Using varchar primary keys.

2013-04-02 Thread Merlin Moncure
On Tue, Apr 2, 2013 at 10:34 AM, Joe Van Dyk j...@tanga.com wrote: On Mon, Apr 1, 2013 at 1:11 PM, Tim Uckun timuc...@gmail.com wrote: On Tue, Apr 2, 2013 at 8:35 AM, jesusthefrog jesusthef...@gmail.com wrote: On the topic of 'natural' versus 'synthetic' primary keys, I am generally in

Re: [GENERAL] Money casting too liberal?

2013-04-02 Thread John R Pierce
On 4/2/2013 12:50 AM, Gavin Flower wrote: In the bad old days when I was a COBOL programmer we always stored money in the COBOL equivalent of an integer (numeric without a fractional part) to avoid round off, but we displayed with a decimal point to digits to the left. So storing as an integer

Re: [GENERAL] Dynamic/polymorphic record/composite return types for C user-defined-functions

2013-04-02 Thread Misa Simic
Hi, We have solved that problem on the way to function always returns text, but text was actually formated json... We have used plv8 before 9.2 to actually execute dynamic SQL and return result... However, I think some kind of dynamic record type would be very usefull... (Maybe just record but

Re: [GENERAL] Money casting too liberal?

2013-04-02 Thread Gavin Flower
On 03/04/13 07:16, John R Pierce wrote: On 4/2/2013 12:50 AM, Gavin Flower wrote: In the bad old days when I was a COBOL programmer we always stored money in the COBOL equivalent of an integer (numeric without a fractional part) to avoid round off, but we displayed with a decimal point to

Re: [GENERAL] Using varchar primary keys.

2013-04-02 Thread Merlin Moncure
On Tue, Apr 2, 2013 at 2:01 PM, Samantha Atkins sjatk...@me.com wrote: Natural keys are in user data space. Thus they are not guaranteed invariant and therefore cannot serve as persistent identity. That is true, but irrelevant in most real world cases. Also, nothing is keeping you from using

Re: [GENERAL] create temporary table problem

2013-04-02 Thread Jerry Sievers
JPrasanna Venkatesan prasanna1...@gmail.com writes: Dear All, I am usnig PGSQL 9.0 When I tried to create a temporary table it is throwing the following error ERROR:? could not create directory pg_tblspc/16385/PG_9.0_201008051/20304: No such file or directory You forgot to migrate your

[GENERAL] corrupted item pointer in streaming based replication

2013-04-02 Thread Jigar Shah
Hi, Few days ago we started getting the below message and postgres on our server(streaming replication secondary) would not startup. I am wondering what are our options at this point. Can we do something to fix this? 2013-03-27 11:00:47.281 PDT LOG: recovery restart point at 161A/17108AA8

Re: [GENERAL] Using varchar primary keys.

2013-04-02 Thread Joe Van Dyk
On Tue, Apr 2, 2013 at 11:16 AM, Merlin Moncure mmonc...@gmail.com wrote: On Tue, Apr 2, 2013 at 10:34 AM, Joe Van Dyk j...@tanga.com wrote: On Mon, Apr 1, 2013 at 1:11 PM, Tim Uckun timuc...@gmail.com wrote: On Tue, Apr 2, 2013 at 8:35 AM, jesusthefrog jesusthef...@gmail.com

Re: [GENERAL] in C trigger function find out if column is part of primary key

2013-04-02 Thread Kevin Grittner
Enke, Dr., Michael michael.e...@wincor-nixdorf.com wrote: I have to find out if a column ( i = 0, …, tupdesc-natts-1 ) is part of a primary key but for performance reasons I do not want to execute another query via SPI.  Is this possible? You might get some inspiration from looking at this bit

[GENERAL] Dynamic/polymorphic record/composite return types for C user-defined-functions

2013-04-02 Thread Stephen Scheck
On Tue, Apr 2, 2013 at 10:55 AM, Tom Lane t...@sss.pgh.pa.us wrote: if you just write SELECT function_returning_record(...) FROM ... and not SELECT (function_returning_record(...)).* FROM ... I think that the run-time-blessed-record-type hack will work okay. Of course

[GENERAL] How can I perform client-only installation from source code on Windows?

2013-04-02 Thread MauMau
Hello, Is there any way to perform client-only installation from source code on Windows? On UNIX/Linux, client-only installation is described here: http://www.postgresql.org/docs/current/static/install-procedure.html [Excerpt] Client-only installation: If you want to install only the

[GENERAL] PostgreSQL: CPU utilization creeping to 100%

2013-04-02 Thread David Noel
I'm running into a strange issue whereby my postgres processes are slowly creeping to 100% CPU utilization. I'm running postgresql-server-9.2.3, FreeBSD 8.3-RELEASE-p6, and using the postgresql-9.2-1002.jdbc4 driver. I'm not sure what information here is relevant, so I'll give everything I can as

Re: [GENERAL] PostgreSQL: CPU utilization creeping to 100%

2013-04-02 Thread Ian Lawrence Barwick
2013/4/3 David Noel david.i.n...@gmail.com: I'm running into a strange issue whereby my postgres processes are slowly creeping to 100% CPU utilization. I'm running postgresql-server-9.2.3, FreeBSD 8.3-RELEASE-p6, and using the postgresql-9.2-1002.jdbc4 driver. (...) postgresql.conf, all

Re: [GENERAL] PostgreSQL: CPU utilization creeping to 100%

2013-04-02 Thread David Noel
What's strange is that the crawler will run just fine for up to several hours. At some point though the CPU utilization slowly begins to creep higher. Eventually everything locks and the program hangs. 'top' shows the processes connected to the queue database at or near %100, and the program

Re: [GENERAL] PostgreSQL: CPU utilization creeping to 100%

2013-04-02 Thread Kevin Grittner
David Noel david.i.n...@gmail.com wrote: 'select * from pg_stat_activity' shows that the queries are not waiting, and are in the idle state. The process is idle or the process is running the query?  If the latter, what do you mean when you say the queries ... are in the idle state? -- Kevin

Re: [GENERAL] PostgreSQL: CPU utilization creeping to 100%

2013-04-02 Thread John R Pierce
On 4/2/2013 3:35 PM, David Noel wrote: The hardware is a Dell PowerEdge 1420, dual Xeon Nocona's, 3.2ghz, 16gb ram. The disks are 4 Kingston HyperX SATA3's attached to a HighPoint RocketRAID 2721 controller, ZFS, RAID10. . postgresql.conf, all standard/default except for: max_connections =

Re: [GENERAL] PostgreSQL: CPU utilization creeping to 100%

2013-04-02 Thread David Noel
On 4/2/13, Ian Lawrence Barwick barw...@gmail.com wrote: 2013/4/3 David Noel david.i.n...@gmail.com: I'm running into a strange issue whereby my postgres processes are slowly creeping to 100% CPU utilization. I'm running postgresql-server-9.2.3, FreeBSD 8.3-RELEASE-p6, and using the

Re: [GENERAL] PostgreSQL: CPU utilization creeping to 100%

2013-04-02 Thread David Noel
On 4/2/13, Kevin Grittner kgri...@ymail.com wrote: David Noel david.i.n...@gmail.com wrote: 'select * from pg_stat_activity' shows that the queries are not waiting, and are in the idle state. The process is idle or the process is running the query? If the latter, what do you mean when you

Re: [GENERAL] PostgreSQL: CPU utilization creeping to 100%

2013-04-02 Thread David Noel
On 4/2/13, John R Pierce pie...@hogranch.com wrote: On 4/2/2013 3:35 PM, David Noel wrote: The hardware is a Dell PowerEdge 1420, dual Xeon Nocona's, 3.2ghz, 16gb ram. The disks are 4 Kingston HyperX SATA3's attached to a HighPoint RocketRAID 2721 controller, ZFS, RAID10. .

Re: [GENERAL] Using varchar primary keys.

2013-04-02 Thread Julian
On 03/04/13 06:37, Merlin Moncure wrote: On Tue, Apr 2, 2013 at 2:01 PM, Samantha Atkins sjatk...@me.com wrote: Natural keys are in user data space. Thus they are not guaranteed invariant and therefore cannot serve as persistent identity. Can't find Samantha's original post. I agree but done

Re: [GENERAL] Using varchar primary keys.

2013-04-02 Thread Samantha Atkins
Natural keys are in user data space. Thus they are not guaranteed invariant and therefore cannot serve as persistent identity. Also natural keys have the considerable defect of being of different type and arity per logical entity type. This means that very nice things like dynamic