Re: [GENERAL] Why doesn't `RAISE EXCEPTION` provide error context?

2015-04-02 Thread David G. Johnston
On Thursday, April 2, 2015, Pavel Stehule pavel.steh...@gmail.com wrote: 2015-04-02 9:13 GMT+02:00 David G. Johnston david.g.johns...@gmail.com javascript:_e(%7B%7D,'cvml','david.g.johns...@gmail.com');: Adding raw content present on Nabble that gets filtered by the mailing list. On

Re: [GENERAL] Why doesn't `RAISE EXCEPTION` provide error context?

2015-04-02 Thread Pavel Stehule
The OP on this thread has introduced a potential compromise. Keep the current printing behavior for RAISE but the construction of the error itself should contain all of the relevant detail so that the caller can get to the suppressed information via, in this instance, GET STACKED DIAGNOSTICS

Re: [GENERAL] Why doesn't `RAISE EXCEPTION` provide error context?

2015-04-02 Thread Pavel Stehule
2015-04-02 9:13 GMT+02:00 David G. Johnston david.g.johns...@gmail.com: Adding raw content present on Nabble that gets filtered by the mailing list. On Wednesday, April 1, 2015, Taytay tay...@youneedabudget.com wrote: We make heavy use of `GET STACKED DIAGNOSTICS` to determine where errors

Re: [GENERAL] Why doesn't `RAISE EXCEPTION` provide error context?

2015-04-02 Thread David G. Johnston
Adding raw content present on Nabble that gets filtered by the mailing list. On Wednesday, April 1, 2015, Taytay tay...@youneedabudget.com wrote: We make heavy use of `GET STACKED DIAGNOSTICS` to determine where errors happened. However, I am trying to use RAISE EXCEPTION to report errors,

Re: [GENERAL] The case of PostgreSQL on NFS Server (II)

2015-04-02 Thread David G. Johnston
On Thu, Apr 2, 2015 at 1:01 PM, Octavi Fors oct...@live.unc.edu wrote: I don't see how to migrate the databases from my desktop directory determined in a) to my NAS. Could someone please provide the steps to accomplish that? ALTER DATABASE name SET TABLESPACE new_tablespace ​You are solely

Re: [GENERAL] now() vs 'epoch'::timestamp

2015-04-02 Thread Adrian Klaver
On 04/02/2015 11:01 AM, Steve Crawford wrote: On 04/02/2015 10:34 AM, David G. Johnston wrote: On Thu, Apr 2, 2015 at 10:27 AM, James Cloos cl...@jhcloos.com mailto:cl...@jhcloos.comwrote: SC == Steve Crawford scrawf...@pinpointresearch.com mailto:scrawf...@pinpointresearch.com

Re: [GENERAL] The case of PostgreSQL on NFS Server (II)

2015-04-02 Thread John McKown
On Thu, Apr 2, 2015 at 3:01 PM, Octavi Fors oct...@live.unc.edu wrote: Hi, this is somehow overlapping one thread which was already posted in this list here. However, I'm newbie in PostgreSQL and would need some help from experts on two aspects. I apologize if these were already implicitely

Re: [GENERAL] The case of PostgreSQL on NFS Server (II)

2015-04-02 Thread Steve Atkins
On Apr 2, 2015, at 5:09 PM, Octavi Fors oct...@live.unc.edu wrote: And second, because I need the database to be accessible from two computers in the same LAN. If you do this, you will destroy your database[1]. Why not have the database running on one machine, all the time, potentially

Re: [GENERAL] ERROR: out of memory

2015-04-02 Thread Dzmitry Nikitsin
Thank you David. I see some queries running for 10+ seconds, but I do not have transactions there, it’s just select queries. More thoughts ? Thanks, Dzmitry From: David G. Johnston david.g.johns...@gmail.com Date: Thursday, April 2, 2015 at 8:57 PM To: Bob Jones dzmitry.nikit...@gmail.com

Re: [GENERAL] The case of PostgreSQL on NFS Server (II)

2015-04-02 Thread David G. Johnston
On Thu, Apr 2, 2015 at 5:09 PM, Octavi Fors oct...@live.unc.edu wrote: Thanks John for your extensive and helpful response. I have a NAS box. But I would worry about responsiveness. What is better, IMO, is an external SATA connected DAS box. DAS is Direct Attached Storage. Many PCs have a

[GENERAL] Error handling in C API function calls in a way that doesn't close client connection

2015-04-02 Thread Igor Stassiy
Hello all, This question refers to version 9.4 of Postgres. I have have a function Datum do_something(PG_FUNCTION_ARGS) { ... if(error_occured) { ereport(ERROR, (errmsg(some error occured))); } ... } When I call do_something in a way to deliberately cause the error

Re: [GENERAL] ERROR: out of memory

2015-04-02 Thread David G. Johnston
On Thursday, April 2, 2015, Melvin Davidson melvin6...@gmail.com wrote: Well right of the bat, if your master shared_buffers = 7GB and 3 slaves shared_buffers = 10GB, that is 37GB total, which means you are guaranteed to exceed the 30GB physical limit on your machine. I don't get why you are

[GENERAL] ERROR: out of memory

2015-04-02 Thread Dzmitry Nikitsin
Hey folks, I have 4 postgresql servers 9.3.6(on master I use 9.3.5) configured with streaming replication - with 1 maser(30GB RAM, processor - Intel Xeon E5-2680 v2) and 3 slaves(61 Intel Xeon E5-2670 v2), all on Ubuntu 14.04.1 LTS, Master configuration: default_statistics_target = 50

Re: [GENERAL] ERROR: out of memory

2015-04-02 Thread Dzmitry Nikitsin
it¹s 4 different servers. From: David G. Johnston david.g.johns...@gmail.com Date: Thursday, April 2, 2015 at 9:37 PM To: Melvin Davidson melvin6...@gmail.com Cc: Bob Jones dzmitry.nikit...@gmail.com, pgsql-general@postgresql.org pgsql-general@postgresql.org Subject: Re: [GENERAL] ERROR: out

Re: [GENERAL] The case of PostgreSQL on NFS Server (II)

2015-04-02 Thread Octavi Fors
Thanks John for your extensive and helpful response. A few quick answers which may clarify my desktop-NAS system details: If you are running SELinux enabled enforcing, it is even more complicated. -no, I'm not running SELinux. -My NAS is a Synology DS2415+

Re: [GENERAL] The case of PostgreSQL on NFS Server (II)

2015-04-02 Thread John McKown
On Thu, Apr 2, 2015 at 7:09 PM, Octavi Fors oct...@live.unc.edu wrote: Thanks John for your extensive and helpful response. snip You see that I used the ALTER from David in last message, instead your suggestion of creating the whole database again. Looks good! snip Two only questions

Re: [GENERAL] ERROR: out of memory

2015-04-02 Thread Melvin Davidson
Well right of the bat, if your master shared_buffers = 7GB and 3 slaves shared_buffers = 10GB, that is 37GB total, which means you are guaranteed to exceed the 30GB physical limit on your machine. General recommendation is to only allocate 1/4 total memory for shared_buffers, so start by cutting

Re: [GENERAL] ERROR: out of memory

2015-04-02 Thread David G. Johnston
On Thu, Apr 2, 2015 at 5:24 PM, Dzmitry Nikitsin dzmitry.nikit...@gmail.com wrote: Hey folks, I have 4 postgresql servers 9.3.6(on master I use 9.3.5) configured with streaming replication - with 1 maser(30GB RAM, processor - Intel Xeon E5-2680 v2) and 3 slaves(61 Intel Xeon E5-2670 v2),

Re: [GENERAL] ERROR: out of memory

2015-04-02 Thread Dzmitry Nikitsin
Actually I checked it wrong, state for queries I mentioned is idle, I.e. - they are showing previous transaction, so I do not see any long running transactions right now. Thanks, Dzmitry From: David G. Johnston david.g.johns...@gmail.com Date: Thursday, April 2, 2015 at 8:57 PM To: Bob

[GENERAL] quick q re execute scope of new

2015-04-02 Thread Scott Ribe
Easier to give an example than describe the question, any chance of making something like this work? execute('insert into ' || tblname || ' values(new.*)'); -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ https://www.linkedin.com/in/scottribe/ (303) 722-0567 voice

[GENERAL] implicit CAST on CSV COPY FROM

2015-04-02 Thread Geoff Winkless
Hi I have a set of CSV data that I'm importing containing dates stored as INT values (eg 20150402). The value 0 represents a null date in this format. I've created a function and cast that (ab)uses the system text::date cast: CREATE FUNCTION to_date(integer) RETURNS date AS $$SELECT CASE WHEN

Re: [GENERAL] quick q re execute scope of new

2015-04-02 Thread Scott Ribe
On Apr 2, 2015, at 10:14 PM, Adrian Klaver adrian.kla...@aklaver.com wrote: EXECUTE 'insert into ' || quote_ident(tblname) || ' values(' || new.* || ')' Not that easy, strings are not quoted correctly, and null values are blank. Might be a function to translate new.* into a string as needed

Re: [GENERAL] Error handling in C API function calls in a way that doesn't close client connection

2015-04-02 Thread Tom Lane
Igor Stassiy istas...@gmail.com writes: This question refers to version 9.4 of Postgres. I have have a function Datum do_something(PG_FUNCTION_ARGS) { ... if(error_occured) { ereport(ERROR, (errmsg(some error occured))); } ... } When I call do_something in a way

Re: [GENERAL] quick q re execute scope of new

2015-04-02 Thread Adrian Klaver
On 04/02/2015 08:30 PM, Scott Ribe wrote: Easier to give an example than describe the question, any chance of making something like this work? You doing this in plpgsql trigger function I presume? execute('insert into ' || tblname || ' values(new.*)'); So

Re: [GENERAL] quick q re execute scope of new

2015-04-02 Thread Tom Lane
Scott Ribe scott_r...@elevated-dev.com writes: Easier to give an example than describe the question, any chance of making something like this work? execute('insert into ' || tblname || ' values(new.*)'); Not like that, for certain. It might work to use EXECUTE ... USING new.* or some variant

Re: [GENERAL] quick q re execute scope of new

2015-04-02 Thread Scott Ribe
On Apr 2, 2015, at 10:10 PM, Tom Lane t...@sss.pgh.pa.us wrote: Not like that, for certain. It might work to use EXECUTE ... USING new.* or some variant of that. Couldn't get a variant of that to work, but this did: execute('insert into ' || tblnm || ' select $1.*') using new; -- Scott

[GENERAL] bdr global sequence not initialized

2015-04-02 Thread Vu Nguyen
I install patched PostgreSQL 9.4.1 with BDR 0.9.0, and set up a BDR group of 2 linux hosts, each has 4 replicated databases. Global sequence is enabled (whose configuration is added in postgresql.conf). When I insert new records into any of 4 databases in the first host (created via

Re: [GENERAL] Would like to know how analyze works technically

2015-04-02 Thread TonyS
On Wed, April 1, 2015 5:50 pm, Tom Lane-2 [via PostgreSQL] wrote: TonyS t...@exquisiteimages.com writes: The analyze function has crashed again while the overcommit entries were as above. The last bit of the PostgreSQL log shows: MdSmgr: 41934848 total in 14 blocks; 639936 free (0 chunks);

Re: [GENERAL] Why doesn't `RAISE EXCEPTION` provide error context?

2015-04-02 Thread Taytay
There appears to be a fair amount of nuance here, but I am _very_ impressed with how quickly you have responded. Thank you for your quick attention to this issue! (Yet another thing that makes me happy to be using Postgres). We have fair amount of business logic in Postgres functions, and the

Re: [GENERAL] implicit CAST on CSV COPY FROM

2015-04-02 Thread Adrian Klaver
On 04/02/2015 04:07 AM, Geoff Winkless wrote: Hi I have a set of CSV data that I'm importing containing dates stored as INT values (eg 20150402). The value 0 represents a null date in this format. I've created a function and cast that (ab)uses the system text::date cast: CREATE FUNCTION

Re: [GENERAL] Relation name stored in Postgres

2015-04-02 Thread Melvin Davidson
The table name is stored in pg_class when you execute the CREATE TABLE statement. The PostgreSQL main program, postmaster handles all the work. It appears to me your concept of how PostgreSQL works is very distorted. Perhaps you would best be served by purchasing and reading Beginning Databases

Re: [GENERAL] How to recover or resent the password for the user 'postgres'

2015-04-02 Thread Arup Rakshit
On Monday, March 30, 2015 06:27:19 AM Adrian Klaver wrote: On 03/30/2015 01:09 AM, Arup Rakshit wrote: Hi, I am trying to follow what has been mentioned below **Setting Up Postgres** (https://www.digitalocean.com/community/tutorials/how-to-setup-ruby-on-rails-with-postgres). But no

Re: [GENERAL] Relation name stored in Postgres

2015-04-02 Thread Pavel Stehule
2015-04-02 16:26 GMT+02:00 Ravi Kiran ravi.kolanp...@gmail.com: Hi, Thank you Sir. Also, could you tell me during which stage(whether parser,optimizer or executor) does the table name gets stored, and if possible could you tell me which program specifically does that. Usually parser,

[GENERAL] Relation name stored in Postgres

2015-04-02 Thread Ravi Kiran
Hi, I want to know how the relation name is stored in postgres, In which part of the postgres source code could I find the relation name being stored. Thank you -- Regards, K.Ravikiran ᐧ

Re: [GENERAL] Relation name stored in Postgres

2015-04-02 Thread Pavel Stehule
Hi it is in system catalog - table pg_class, column relname Regards Pavel Stehule 2015-04-02 15:52 GMT+02:00 Ravi Kiran ravi.kolanp...@gmail.com: Hi, I want to know how the relation name is stored in postgres, In which part of the postgres source code could I find the relation name being

Re: [GENERAL] Relation name stored in Postgres

2015-04-02 Thread Ravi Kiran
Hi, Thank you Sir. Also, could you tell me during which stage(whether parser,optimizer or executor) does the table name gets stored, and if possible could you tell me which program specifically does that. Thank you. ᐧ On Thu, Apr 2, 2015 at 7:32 PM, Pavel Stehule pavel.steh...@gmail.com wrote:

Re: [GENERAL] Relation name stored in Postgres

2015-04-02 Thread Ravi Kiran
Hi, Also, could you tell me during which stage(whether parser,optimizer or executor) does the table name gets stored, and if possible could you tell me which program specifically does that. ᐧ On Thu, Apr 2, 2015 at 7:56 PM, Ravi Kiran ravi.kolanp...@gmail.com wrote: Hi, Thank you Sir.

Re: [GENERAL] Why doesn't `RAISE EXCEPTION` provide error context?

2015-04-02 Thread Melvin Davidson
I believe the availability of trapping the error codes and raising the appropriate message is already in PLPGSQL. Please see the two sections below. http://www.postgresql.org/docs/9.4/interactive/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING

Re: [GENERAL] now() vs 'epoch'::timestamp

2015-04-02 Thread James Cloos
SC == Steve Crawford scrawf...@pinpointresearch.com writes: SC Very convoluted calculation as others have noted. As to why it is SC off, you are casting one part of the statement to an integer thus SC truncating the microseconds but are not doing the same on the other SC side of the calculation.

Re: [GENERAL] now() vs 'epoch'::timestamp

2015-04-02 Thread David G. Johnston
On Thu, Apr 2, 2015 at 10:27 AM, James Cloos cl...@jhcloos.com wrote: SC == Steve Crawford scrawf...@pinpointresearch.com writes: SC Very convoluted calculation as others have noted. As to why it is SC off, you are casting one part of the statement to an integer thus SC truncating the

Re: [GENERAL] Why doesn't `RAISE EXCEPTION` provide error context?

2015-04-02 Thread Taylor Brown
Indeed it is possible Melvin. I read through those links, and I am afraid I wasn't clear enough. If Postgres throws an exception, we can handle it and get the context, which will allow us to pinpoint exactly where the problem was, and what functions were called leading up to the error. However,

Re: [GENERAL] now() vs 'epoch'::timestamp

2015-04-02 Thread James Cloos
SC == Steve Crawford scrawf...@pinpointresearch.com writes: SC select (now() - (now() - 'epoch')) ; SC ?column? SC SC 1969-12-31 17:00:00-08 My servers all run in UTC, so that query works here. The first query where I noticed this, I had just run date +%s and

Re: [GENERAL] now() vs 'epoch'::timestamp

2015-04-02 Thread Steve Crawford
On 04/02/2015 10:34 AM, David G. Johnston wrote: On Thu, Apr 2, 2015 at 10:27 AM, James Cloos cl...@jhcloos.com mailto:cl...@jhcloos.comwrote: SC == Steve Crawford scrawf...@pinpointresearch.com mailto:scrawf...@pinpointresearch.com writes: ... What I haven't determined is

Re: [GENERAL] now() vs 'epoch'::timestamp

2015-04-02 Thread James Cloos
DGJ == David G Johnston david.g.johns...@gmail.com writes: DGJ ​What timezone is your server set to - and/or the client requesting the DGJ calculation? Everything is in UTC. -JimC -- James Cloos cl...@jhcloos.com OpenPGP: 0x997A9F17ED7DAEA6 -- Sent via pgsql-general mailing list

[GENERAL] The case of PostgreSQL on NFS Server (II)

2015-04-02 Thread Octavi Fors
Hi, this is somehow overlapping one thread which was already posted in this list here http://www.postgresql.org/message-id/4c22e24c.1040...@air.co.jp. However, I'm newbie in PostgreSQL and would need some help from experts on two aspects. I apologize if these were already implicitely mentioned