Here is a patch to amend the docs here:
https://www.postgresql.org/docs/devel/static/plpgsql-trigger.html
In the example for an AFTER trigger, you see this code:
--
-- Create a row in emp_audit to reflect the operation performed on emp,
-- make use of the special variable TG_OP to w
On 12/25/2015 03:23 AM, Ildus Kurbangaliev wrote:
On Fri, 25 Dec 2015 13:34:25 +0300
Teodor Sigaev wrote:
First, variables (high and low) should not be declared in the middle
of code. Second, assert will fail if ua.v64[0] == ub.v64[0] and
ua.v64[1] > ub.v64[1] although it's a possible and allow
On 12/23/2015 08:10 AM, Ildus Kurbangaliev wrote:
There is a more improved version of the patch. Main idea is to present
uuid as two uint64 values, and make comparisons and penalty calculation
based on these values. This approach is much faster than using memcmp
for uuid comparisons.
Thank you
Or something like this in pseudocode:
numeric = int8_numeric(*(uint64 *)(&i->data[0])) *
int8_numeric(MAX_INT64) + int8_numeric(*(uint64 *)(&i->data[8]))
This is more like what I was hoping for, rather than converting to a
string and back. Would you mind confirming for me: int8_numeric turns a
2)
static double
uuid2num(const pg_uuid_t *i)
{
return *((uint64 *)i);
}
It isn't looked as correct transformation for me. May be, it's better
to transform to numeric type (UUID looks like a 16-digit hexademical
number)
and follow gbt_numeric_penalty() log