Search Postgresql Archives

Re: Partitioning and ORM tools

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/22/2016 02:20 PM, CS DBA wrote:


On 03/22/2016 03:18 PM, Rob Sargent wrote:


On 03/22/2016 03:00 PM, Joshua D. Drake wrote:
On 03/22/2016 01:50 PM, CS DBA wrote:

Understood, was just wondering if there is a way to cause the child
table insert results to be returned to the ORM/Application instead of
the master/base table insert

Insert into the child table directly based on the partition rules.

JD


I would think the ORM (as yet undefined) would want to think in terms
of the parent table and not know about the physical schema details.
Can  the client not be written to check only for errors vs checking
for non-zero inserts?



That was our first suggestion, they don;t want to make any app changes

So the ORM is parsing the INSERT return value, correct?

Would something like this(borrowing from docs example) freak it out?:

CREATE OR REPLACE FUNCTION measurement_insert_trigger()
RETURNS TRIGGER AS $$
DECLARE
    _ct int;
BEGIN
    INSERT INTO measurement_y2016m03 VALUES (NEW.*);
    SELECT INTO  _ct count(NEW.*);
    RAISE NOTICE 'INSERT 0 %', _ct;
    RETURN NULL;
END;
$$
LANGUAGE plpgsql;

test=# insert into measurement values(1, '03/21/2016', 50, 87);
NOTICE:  INSERT 0 1
INSERT 0 0









--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux