[GENERAL] upsert with trigger (or rule)

2016-07-19 Thread Maeldron T.
Hello, I’m trying to rewrite inserts to upserts on a table when a certain column has a certain value. Reason: the inserts are coming from an ORM. It’s possible to send upsert from the ORM, however, in this case I find it more elegant and future-proof to deal with it at the DB level

Re: [GENERAL] upsert with trigger (or rule)

2016-07-19 Thread Maeldron T.
Hello Adrian, On 19/07/16 21:27, Adrian Klaver wrote: On 07/19/2016 11:56 AM, Maeldron T. wrote: By returning NULL in your function you are skipping the original INSERT. I know that, I wrote it. I am sure exactly what you are trying to achieve, In general, there are the

Re: [GENERAL] upsert with trigger (or rule)

2016-07-20 Thread Maeldron T.
On 19/07/16 23:45, Adrian Klaver wrote: To be more complete it would nice to see the schema definition for the table messages. Also maybe some idea of what you the code is supposed to do. If I understand it correctly: 1) Check if a message is a draft. 2) Check if there is a uniqueness con

Re: [GENERAL] Uber migrated from Postgres to MySQL

2016-07-29 Thread Maeldron T.
On 26/07/16 19:39, Guyren Howe wrote: Honestly, I've never heard of anyone doing that. But it sounds like they had good reasons. https://eng.uber.com/mysql-migration/ Thoughts? 1. Open the page 2. Press Cmd-F on Mac, Ctrl-F on Linux/Windows. (Find on page) 3. Type "transaction" in the sear

[GENERAL] Google Cloud Compute

2016-11-02 Thread Maeldron T.
Hello, I’m considering moving my servers to Google. The main reason is the transparent encryption they offer. This means I should either move all or none. The former would include PostreSQL, specifially: FreeBSD + ZFS + PostgreSQL. Do you have any pros or cons based on experience? (Would fsy

[GENERAL] FreeBSD 10 => 11: Dump and reload your PostgreSQL database unless you like it broken

2016-12-02 Thread Maeldron T.
Hello, I’ll be as short as I can as I have broken my arm and I’m not supposed to type. This isn’t a joke. However, I learned the following the hard way and I want to save you from the same. Upgrading FreeBSD from 10 to 11 might break your database. It probably won’t be corrupted but it will be u

[GENERAL] Re: FreeBSD 10 => 11: Dump and reload your PostgreSQL database unless you like it broken

2016-12-02 Thread Maeldron T.
I forgot to add that when I turned off index scan, select lower() still didn’t find some existing rows. On Sat, Dec 3, 2016 at 2:52 AM, Maeldron T. wrote: > Hello, > > I’ll be as short as I can as I have broken my arm and I’m not supposed to > type. This isn’t a joke. > > Howe

Re: [GENERAL] FreeBSD 10 => 11: Dump and reload your PostgreSQL database unless you like it broken

2016-12-07 Thread Maeldron T.
Hello Thomas, > > (Maybe database clusters should have a header that wouldn’t allow > > incompatible server versions to process the existing data. I wonder if it > > would take more than 8 bytes per server. But I guess it was not know to > be > > incompatible. Even my two CIs didn’t show it.) > >

[GENERAL] BSD initdb without ICU support and switch later

2016-01-29 Thread Maeldron T.
Hello, the ICU patch isn’t ready for PostgreSQL on FreeBSD. Is there any risk (more than 0) in executing the initdb without ICU support and recompiling PostgreSQL later when the ICU patch is ready? I mean any risk without making a dump and import before the switch. If this is okay for su

[GENERAL] Failback to old master

2014-08-28 Thread Maeldron T.
Hello, I swear I have read a couple of old threads. Yet I am not sure if it safe to failback to the old master in case of async replication without base backup. Considering: I have the latest 9.3 server A: master B: slave B is actively connected to A I shut down A manually with -m fast (it's the

[GENERAL] Streaming replication bandwith per table

2017-06-19 Thread Maeldron T.
Hello, tl;dr Streaming replication generates too much traffic to set it up between different regions for financial reasons. The streaming replication would cost more than every other hosting expense altogether (including every the traffic, even though it’s web and huge amount of emails). Is ther

Fwd: [GENERAL] Streaming replication bandwith per table

2017-06-21 Thread Maeldron T.
On Tue, Jun 20, 2017 at 3:06 AM, Peter Eisentraut < peter.eisentr...@2ndquadrant.com> wrote: > > Not easily. You could play around with pg_xlogdump to see what's going > on in the WAL. But even if you figure it out, there is not much you can > do about it. > I could do a lot. For example, if I

Re: Fwd: [GENERAL] Streaming replication bandwith per table

2017-07-05 Thread Maeldron T.
wrote: > On 6/21/17 22:04, Maeldron T. wrote: > > * Logical replication is in 10.0 Beta 1. I might be oldschool but I > > would install 10.1 or maybe 10.0.2 into production > > There are also other logical replication options such as pglogical and > londiste. > > -- > P