63 lines
1.9 KiB
Plaintext
63 lines
1.9 KiB
Plaintext
$OpenBSD: patch-sql_pgq_triggers_common_c,v 1.3 2021/02/09 20:04:36 jeremy Exp $
|
|
|
|
Support PostgreSQL 11.
|
|
|
|
Index: sql/pgq/triggers/common.c
|
|
--- sql/pgq/triggers/common.c.orig
|
|
+++ sql/pgq/triggers/common.c
|
|
@@ -18,7 +18,9 @@
|
|
|
|
#include <postgres.h>
|
|
|
|
+#include <access/htup_details.h>
|
|
#include <commands/trigger.h>
|
|
+#include <common/hashfn.h>
|
|
#include <catalog/pg_type.h>
|
|
#include <catalog/pg_namespace.h>
|
|
#include <executor/spi.h>
|
|
@@ -125,9 +127,9 @@ static void fill_magic_columns(PgqTriggerEvent *ev)
|
|
|
|
for (i = 0; i < tupdesc->natts; i++) {
|
|
/* Skip dropped columns */
|
|
- if (tupdesc->attrs[i]->attisdropped)
|
|
+ if (tupdesc->attrs[i].attisdropped)
|
|
continue;
|
|
- col_name = NameStr(tupdesc->attrs[i]->attname);
|
|
+ col_name = NameStr(tupdesc->attrs[i].attname);
|
|
if (!is_magic_field(col_name))
|
|
continue;
|
|
if (strcmp(col_name, "_pgq_ev_type") == 0)
|
|
@@ -481,7 +483,7 @@ static void parse_oldstyle_args(PgqTriggerEvent *ev, T
|
|
*/
|
|
tupdesc = tg->tg_relation->rd_att;
|
|
for (i = 0, attcnt = 0; i < tupdesc->natts; i++) {
|
|
- if (!tupdesc->attrs[i]->attisdropped)
|
|
+ if (!tupdesc->attrs[i].attisdropped)
|
|
attcnt++;
|
|
}
|
|
|
|
@@ -598,9 +600,9 @@ bool pgqtriga_skip_col(PgqTriggerEvent *ev, int i, int
|
|
const char *name;
|
|
|
|
tupdesc = tg->tg_relation->rd_att;
|
|
- if (tupdesc->attrs[i]->attisdropped)
|
|
+ if (tupdesc->attrs[i].attisdropped)
|
|
return true;
|
|
- name = NameStr(tupdesc->attrs[i]->attname);
|
|
+ name = NameStr(tupdesc->attrs[i].attname);
|
|
|
|
if (is_magic_field(name)) {
|
|
ev->tgargs->custom_fields = 1;
|
|
@@ -632,9 +634,9 @@ bool pgqtriga_is_pkey(PgqTriggerEvent *ev, int i, int
|
|
return ev->attkind[attkind_idx] == 'k';
|
|
} else if (ev->pkey_list) {
|
|
tupdesc = tg->tg_relation->rd_att;
|
|
- if (tupdesc->attrs[i]->attisdropped)
|
|
+ if (tupdesc->attrs[i].attisdropped)
|
|
return false;
|
|
- name = NameStr(tupdesc->attrs[i]->attname);
|
|
+ name = NameStr(tupdesc->attrs[i].attname);
|
|
if (is_magic_field(name)) {
|
|
ev->tgargs->custom_fields = 1;
|
|
return false;
|