Re: [GENERAL] How to convert a double value to a numeric datum type in pgsql?

2014-02-23 Thread Pavel Stehule
2014-02-24 8:42 GMT+01:00 Felix.徐 : > Thanks , I find another function called OidInputFunctionCall which can > automatically generate a datum from a string for any data type, but seems > it is not recommended in the comments. > it is little bit different - and it needs a second conversion - doubl

Re: [GENERAL] How to convert a double value to a numeric datum type in pgsql?

2014-02-23 Thread Pavel Stehule
hello you have to look to postgresql/src/backend/utils/adt/numeric.c functions - then you can call float8_numeric Numeric result = DatumGetNumeric(DirectFunctionCall1(float8_numeric, Float8GetDatum(dx)); regards Pavel 2014-02-24 7:45 GMT+01:00 Felix.徐 : > Hi all, > I'm talking about the sou

Re: [GENERAL] How to continue streaming replication after this error?

2014-02-23 Thread Michael Paquier
On Mon, Feb 24, 2014 at 12:23 PM, Torsten Förtsch wrote: > On 22/02/14 03:21, Torsten Förtsch wrote: > > Any idea what that means? > > Updating the replica to 9.3.3 cured it. The master was already on 9.3.3. > 9.3.3 has introduced some new configuration parameters. So you need to actually update a

[GENERAL] How to convert a double value to a numeric datum type in pgsql?

2014-02-23 Thread Felix . 徐
Hi all, I'm talking about the source code of pgsql and I want to know how the typing system works in pgsql. A few functions can help us do the type conversion, for example: Int32GetDatum -- convert a integer to a datum Float8GetDatum -- convert double to a datum cstring_to_text -- convert a string

Re: [GENERAL] Why does PostgreSQL ftruncate before unlink?

2014-02-23 Thread Tom Lane
Jon Nelson writes: > On Sun, Feb 23, 2014 at 9:49 PM, Tom Lane wrote: >> If memory serves, the inode should get removed during the next checkpoint. > I was moments away from commenting to say that I had traced the flow > of the code to md.c and found the comments there quite illuminating. I > wo

Re: [GENERAL] Why does PostgreSQL ftruncate before unlink?

2014-02-23 Thread Jon Nelson
On Sun, Feb 23, 2014 at 9:49 PM, Tom Lane wrote: > Jeff Janes writes: >> On Sunday, February 23, 2014, Scott Marlowe wrote: >>> I'm guessing that this is so that it can be rolled back. Unlink is >>> likely issued at commit; > >> I would hope that ftruncate is issued at commit as well. That does

Re: [GENERAL] Why does PostgreSQL ftruncate before unlink?

2014-02-23 Thread Tom Lane
Jeff Janes writes: > On Sunday, February 23, 2014, Scott Marlowe wrote: >> I'm guessing that this is so that it can be rolled back. Unlink is >> likely issued at commit; > I would hope that ftruncate is issued at commit as well. That doesn't > sound undoable. It's more subtle than that. I'm t

Re: [GENERAL] Why does PostgreSQL ftruncate before unlink?

2014-02-23 Thread Jeff Janes
On Sunday, February 23, 2014, Scott Marlowe wrote: > On Fri, Feb 21, 2014 at 4:14 PM, Jon Nelson > > > wrote: > > When dropping lots of tables, I noticed postgresql taking longer than > > I would have expected. > > > > strace seems to report that the largest contributor is the ftruncate > > and

Re: [GENERAL] How to continue streaming replication after this error?

2014-02-23 Thread Torsten Förtsch
On 22/02/14 03:21, Torsten Förtsch wrote: >> 2014-02-21 05:17:10 UTC PANIC: heap2_redo: unknown op code 32 >> > 2014-02-21 05:17:10 UTC CONTEXT: xlog redo UNKNOWN >> > 2014-02-21 05:17:11 UTC LOG: startup process (PID 1060) was terminated >> > by signal 6: Aborted >> > 2014-02-21 05:17:11 UTC LO

Re: [GENERAL] Why does PostgreSQL ftruncate before unlink?

2014-02-23 Thread Scott Marlowe
On Fri, Feb 21, 2014 at 4:14 PM, Jon Nelson wrote: > When dropping lots of tables, I noticed postgresql taking longer than > I would have expected. > > strace seems to report that the largest contributor is the ftruncate > and not the unlink. I'm curious what the logic is behind using > ftruncate

Re: [GENERAL] How to continue streaming replication after this error?

2014-02-23 Thread Haribabu Kommi
On Sat, Feb 22, 2014 at 1:21 PM, Torsten Förtsch wrote: > On 21/02/14 09:17, Torsten Förtsch wrote: > > one of our streaming replicas died with > > > > 2014-02-21 05:17:10 UTC PANIC: heap2_redo: unknown op code 32 > > 2014-02-21 05:17:10 UTC CONTEXT: xlog redo UNKNOWN > > 2014-02-21 05:17:11 UTC

Re: [GENERAL] sum from table 1, where from table 2

2014-02-23 Thread Adrian Klaver
On 02/23/2014 10:12 AM, John Smith wrote: Testing Stefans theory about formatting of email. test=> select version(); version ---

Re: [GENERAL] Test

2014-02-23 Thread Adrian Klaver
On 02/23/2014 10:57 AM, Adrian Klaver wrote: I tried sending email reply to this list and it was flagged as spam. Just testing Thanks to quick response from Stefan Kaltenbrunner, the problem has been identified. I was responding to John Smiths email and it turns out that tripped the spam filt

[GENERAL] Test

2014-02-23 Thread Adrian Klaver
I tried sending email reply to this list and it was flagged as spam. Just testing Thanks, -- Adrian Klaver adrian.kla...@aklaver.com -- 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] sum from table 1, where from table 2

2014-02-23 Thread John Smith
it works (diego != deigo). thanks, jzs -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] sum from table 1, where from table 2

2014-02-23 Thread John Smith
i have two tables, like so: 1. create table public.vote ( sn integer primary key, total integer, cityvarchar(24) ); sn | total | city 1 | 11| new york 2 | 27| los angeles 3 | 58| san diego 2. create tabl