Re: [GENERAL] PostgreSQL server listen on other port than 5432

2009-08-02 Thread Dotan Barak
Hi. On Thu, Jul 30, 2009 at 7:33 PM, Tom Lane wrote: > Dotan Barak writes: >> The weird thing is that i used this port in a service that i wrote >> only few seconds before this happened... > > Oh?  How'd you start that service exactly? > > I'm thinking maybe the postmaster inherited the open file

Re: [GENERAL] building a binary-portable database

2009-08-02 Thread Martijn van Oosterhout
On Sun, Aug 02, 2009 at 01:42:13AM -0400, Alexy Khrabrov wrote: > Well, my question, of course, is, how come all those differences might > affect PG binary data so much -- portable design would try to minimize > such effects, wouldn't it? Does it optimize for all of the above > intentionally

Re: [GENERAL] Division by zero

2009-08-02 Thread Oliver Kohll - Mailing Lists
On 31 Jul 2009, at 19:49, Jeff Davis wrote: Yes -- you can do what you want anyway. If you want it to be more readable, you can redefine the division operator yourself -- it's just a function and operator that happens to be named "/" (although that might not be wise). Maybe you can call it "

Re: [GENERAL] Division by zero

2009-08-02 Thread Sam Mason
On Sun, Aug 02, 2009 at 12:08:28PM +0100, Oliver Kohll - Mailing Lists wrote: > -- This routine creates an alterantive division operator > -- that doesn't throw an error on a divide by zero > -- but rather returns null > > CREATE OR REPLACE FUNCTION gtpb_divide(integer, integer) RETURNS integer >

Re: [GENERAL] questions on (parallel) COPY and when to REINDEX

2009-08-02 Thread Alban Hertroys
On 1 Aug 2009, at 23:24, Janet Jacobsen wrote: Both of the big tables (now up to > 15 M rows each) have indexes on several of the columns. The indexes were created using CREATE INDEX CONCURRENTLY... Both tables have one or two foreign key constraints. Others have answered some of your questio

Re: [GENERAL] Division by zero

2009-08-02 Thread Pavel Stehule
2009/8/2 Sam Mason : > On Sun, Aug 02, 2009 at 12:08:28PM +0100, Oliver Kohll - Mailing Lists wrote: >> -- This routine creates an alterantive division operator >> -- that doesn't throw an error on a divide by zero >> -- but rather returns null >> >> CREATE OR REPLACE FUNCTION gtpb_divide(integer,

Re: [GENERAL] Run procedure at startup

2009-08-02 Thread Jasen Betts
On 2009-07-27, Saleem EDAH-TALLY wrote: > --Boundary-00=_NZcbKOfdE2cMluA > Content-Type: text/plain; > charset="us-ascii" > Content-Transfer-Encoding: 7bit > > Hello, > > Is there a way to run a pl/pgsql automatically at server startup ? pgagent perhaps? modify the startup scripts? > Is there

Re: [GENERAL] Division by zero

2009-08-02 Thread Sam Mason
On Sun, Aug 02, 2009 at 02:20:18PM +0200, Pavel Stehule wrote: > 2009/8/2 Sam Mason : > > On Sun, Aug 02, 2009 at 12:08:28PM +0100, Oliver Kohll - Mailing Lists > > wrote: > >> CREATE OR REPLACE FUNCTION gtpb_divide(integer, integer) RETURNS integer > >> AS 'SELECT $1 / NULLIF($2,0);' > >> LANGUAG

Re: [GENERAL] Division by zero

2009-08-02 Thread Pavel Stehule
2009/8/2 Sam Mason : > On Sun, Aug 02, 2009 at 02:20:18PM +0200, Pavel Stehule wrote: >> 2009/8/2 Sam Mason : >> > On Sun, Aug 02, 2009 at 12:08:28PM +0100, Oliver Kohll - Mailing Lists >> > wrote: >> >> CREATE OR REPLACE FUNCTION gtpb_divide(integer, integer) RETURNS integer >> >> AS 'SELECT $1 /

Re: [GENERAL] Division by zero

2009-08-02 Thread Sam Mason
On Sun, Aug 02, 2009 at 05:22:45PM +0200, Pavel Stehule wrote: > 2009/8/2 Sam Mason : > > On Sun, Aug 02, 2009 at 02:20:18PM +0200, Pavel Stehule wrote: > >> There is paradox - IMMUTABLE function break inlinig :(. There is maybe bug > > > > Not in any tests I've done. > > I did it - and in this ca

Re: [GENERAL] building a binary-portable database

2009-08-02 Thread Alexy Khrabrov
How about portability between systems with the same endianness and bitness, e.g. Intel 64-bit ones? Cheers, Alexy -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Division by zero

2009-08-02 Thread Pavel Stehule
2009/8/2 Sam Mason : > On Sun, Aug 02, 2009 at 05:22:45PM +0200, Pavel Stehule wrote: >> 2009/8/2 Sam Mason : >> > On Sun, Aug 02, 2009 at 02:20:18PM +0200, Pavel Stehule wrote: >> >> There is paradox - IMMUTABLE function break inlinig :(. There is maybe bug >> > >> > Not in any tests I've done. >>

Re: [GENERAL] building a binary-portable database

2009-08-02 Thread Martijn van Oosterhout
On Sun, Aug 02, 2009 at 12:02:41PM -0400, Alexy Khrabrov wrote: > How about portability between systems with the same endianness and > bitness, e.g. Intel 64-bit ones? Some parameters vary between compilers on the same platform. IIRC whether a long on a 64-bit platform is 64-bit depends on the c

Re: [GENERAL] Division by zero

2009-08-02 Thread Sam Mason
On Sun, Aug 02, 2009 at 06:03:11PM +0200, Pavel Stehule wrote: > 2009/8/2 Sam Mason : > > On Sun, Aug 02, 2009 at 05:22:45PM +0200, Pavel Stehule wrote: > >> 2009/8/2 Sam Mason : > >> > On Sun, Aug 02, 2009 at 02:20:18PM +0200, Pavel Stehule wrote: > >> >> There is paradox - IMMUTABLE function brea

Re: [GENERAL] Division by zero

2009-08-02 Thread Pavel Stehule
2009/8/2 Sam Mason : > On Sun, Aug 02, 2009 at 06:03:11PM +0200, Pavel Stehule wrote: >> 2009/8/2 Sam Mason : >> > On Sun, Aug 02, 2009 at 05:22:45PM +0200, Pavel Stehule wrote: >> >> 2009/8/2 Sam Mason : >> >> > On Sun, Aug 02, 2009 at 02:20:18PM +0200, Pavel Stehule wrote: >> >> >> There is parad

Re: [GENERAL] Division by zero

2009-08-02 Thread Tom Lane
Sam Mason writes: > I'm not sure what you're responding to here, but I'm pretty sure the OP > wants IMMUTABLE and does not want STRICT/RETURNS NULL ON NULL INPUT. Yeah --- STRICT will prevent inlining. The function's expression actually is strict, but the planner isn't smart enough about NULLIF

Re: [GENERAL] building a binary-portable database

2009-08-02 Thread Tom Lane
Martijn van Oosterhout writes: > On Sun, Aug 02, 2009 at 12:02:41PM -0400, Alexy Khrabrov wrote: >> How about portability between systems with the same endianness and >> bitness, e.g. Intel 64-bit ones? > There's nothing to stop you trying, but there's been no effort in > making it work. Exact

[GENERAL] Problem trying to load trigger

2009-08-02 Thread Michael Gould
CREATE OR REPLACE FUNCTION iss.accessor_trigger() RETURNS "trigger" AS $$ BEGIN IF(TG_WHEN = 'BEFORE') THEN IF(TG_OP = 'INSERT') THEN NEW.createdatetime := current_timestamp NEW.createuser := current_user ELSIF (TG_OP = 'UPDATE') THEN INSERT into iss.auditaccessor SELECT '

Re: [GENERAL] Problem trying to load trigger

2009-08-02 Thread Alban Hertroys
On 2 Aug 2009, at 19:08, Michael Gould wrote: CREATE OR REPLACE FUNCTION iss.accessor_trigger() RETURNS "trigger" AS $$ BEGIN IF(TG_WHEN = 'BEFORE') THEN IF(TG_OP = 'INSERT') THEN NEW.createdatetime := current_timestamp NEW.createuser := current_user ELSIF (TG_OP = 'UPDATE')

Re: [GENERAL] Problem trying to load trigger

2009-08-02 Thread Tom Lane
Michael Gould writes: > CREATE OR REPLACE FUNCTION iss.accessor_trigger() RETURNS "trigger" AS $$ > BEGIN > IF(TG_WHEN = 'BEFORE') THEN > IF(TG_OP = 'INSERT') THEN > NEW.createdatetime := current_timestamp > NEW.createuser := current_user You've forgotten to end these stateme

Re: [GENERAL] How to execute external script from a TRIGGER or FUNCTION ?

2009-08-02 Thread Denis BUCHER
Andy Colson a écrit : >>> I need to execute an external script from Postgresql, it could be in >>> perl, in bash/shell, in whatever... >>> >>> Any help would be appreciated ! I just need a very simple example if >>> possible... >>> >>> I already searched on the web but found nothing... >> >> After

[GENERAL] character 0xe29986 of encoding "UTF8" has no equivalent in "LATIN2"

2009-08-02 Thread Andreas Kalsch
The function "convert_to(string text, dest_encoding name)" will throw an error and so break my application when not supported characters are included in the unicode string. So what can I do - to filter characters out which have no counterpart in the latin codesets - or to simple ignore wrong cha

Re: [GENERAL] character 0xe29986 of encoding "UTF8" has no equivalent in "LATIN2"

2009-08-02 Thread Sam Mason
On Sun, Aug 02, 2009 at 08:45:52PM +0200, Andreas Kalsch wrote: > Problem: Users will enter _any_ characters in my application and an > error really doesn't help in this case. Then why don't you stop converting to LATIN2? > What I am searching for is a function to undiacritic special letters to

[GENERAL] Use of Postgres in REST/JSON with BLOBS

2009-08-02 Thread Dennis Gearon
I decided on a 'Hybrid Server' approach. I will be piping the BLOBS directly out of the filesystem using HTTP from a 'nginx' server. I *MAY* store the 'real filename' in the database, but I definitely will be storing permissions in the database. I've done EASILY 2 months worth of research and

Re: [GENERAL] Problem trying to load trigger

2009-08-02 Thread Michael Gould
Thanks to everyone who answered. Getting used to PostGres's unique syntax can take time getting used to. Best Regards Michael Gould "Tom Lane" wrote: > Michael Gould writes: >> CREATE OR REPLACE FUNCTION iss.accessor_trigger() RETURNS "trigger" AS $$ >> BEGIN > >> IF(TG_WHEN = 'BEFORE')

Re: [GENERAL] questions on (parallel) COPY and when to REINDEX

2009-08-02 Thread Janet Jacobsen
Thanks for your reply. Responses below, and one follow-up question about when/how often to use analyze. Janet On 02/08/2009 05:09 a.m., Alban Hertroys wrote: On 1 Aug 2009, at 23:24, Janet Jacobsen wrote: My questions are: (2) Should I REINDEX these two tables daily after the pipeline comple

Re: [GENERAL] questions on (parallel) COPY and when to REINDEX

2009-08-02 Thread andy
Janet Jacobsen wrote: Thanks for your reply. Responses below to answer your questions, and one follow-up question on REINDEX. Janet Both tables have one or two foreign key constraints. (2) Should I REINDEX these two tables daily after the pipeline completes? Is this what other people do in

Re: [GENERAL] questions on (parallel) COPY and when to REINDEX

2009-08-02 Thread Andy Colson
On 1 Aug 2009, at 23:24, Janet Jacobsen wrote: My questions are: (2) Should I REINDEX these two tables daily after the pipeline completes? Is this what other people do in practice? No need, but as people are querying as soon as data is arriving, an analyse of the table you just copied to shou

[GENERAL] Problem with Numerics multiplication in C-function

2009-08-02 Thread Ilya Urikh
Hi, I have a strange problem with Numeric multiplication in C-function. There are 2 functions getRate and getVAT which return Numeric. In 3rd function calculateService I try to multiply the results of getRate and getVAT. After execution I have two types of error, some time without messages and wit

Re: [GENERAL] questions on (parallel) COPY and when to REINDEX

2009-08-02 Thread Janet Jacobsen
Hi, Andy. Thanks for the responses and information. Just to let you know... what we are storing in the db are the image attributes - about 40 of them - not the images. So the COPY is reading an ascii file of the image attributes. It turns out to be useful to have the image attributes handy - m

[GENERAL] Problem with Numerics multiplication in C-function

2009-08-02 Thread Ilya Urikh
Hi, I have a strange problem with Numeric multiplication in C-function. There are 2 functions getRate and getVAT which return Numeric. In 3rd function calculateService I try to multiply the results of getRate and getVAT. After execution I have two types of error, some time without messages and wit

Re: [GENERAL] Drop Cluster]

2009-08-02 Thread sweta
> > It seems you are trying to drop a replication cluster, to drop a > this you have to do as follows: > Yes it is a replication cluster. I am using Slony to replicate my 8.1.11 database on CentOS 5. > connect to the node 1(i.e., Master DB) database, check whether the > _

Re: [GENERAL] Drop Cluster]

2009-08-02 Thread Abbas
On Mon, Aug 3, 2009 at 11:11 AM, wrote: > > > > > > > > It seems you are trying to drop a replication cluster, to drop a > > this you have to do as follows: > > > > Yes it is a replication cluster. I am using Slony to replicate > my 8.1.11 database on CentOS 5. > > > > connect

Re: [GENERAL] synchronous_commit=off doesn't always return immediately

2009-08-02 Thread tomrevam
Tom Lane-2 wrote: > > tomrevam writes: > It might help to increase wal_buffers. > Hi, I increased the wal_buffers to 2 MB. Initially this improved the performance very much, but after 4 days of continuous operation the system is back to very long inserts and updates (at least as bad as it w

Re: [GENERAL] Drop Cluster

2009-08-02 Thread sweta
hi, Thankyou Its done :) Regards, Sweta -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general