Skip to content

Commit 457e559

Browse files
committed
hackers: compat cleanup
1 parent 3d8af6b commit 457e559

File tree

9 files changed

+9
-69
lines changed

9 files changed

+9
-69
lines changed

expected/init.out

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ END;$FUNC$ LANGUAGE plpgsql;
3030
GRANT ALL ON SCHEMA public TO nonsuper;
3131
\c :provider_dsn
3232
SET client_min_messages = 'warning';
33-
CREATE EXTENSION IF NOT EXISTS pglogical VERSION '1.0.0';
34-
ALTER EXTENSION pglogical UPDATE;
33+
CREATE EXTENSION IF NOT EXISTS pglogical;
3534
SELECT * FROM pglogical.create_node(node_name := 'test_provider', dsn := (SELECT provider_dsn FROM pglogical_regress_variables()) || ' user=super');
3635
create_node
3736
-------------
@@ -41,12 +40,6 @@ SELECT * FROM pglogical.create_node(node_name := 'test_provider', dsn := (SELECT
4140
\c :subscriber_dsn
4241
SET client_min_messages = 'warning';
4342
CREATE EXTENSION IF NOT EXISTS pglogical;
44-
DO $$
45-
BEGIN
46-
IF (SELECT setting::integer/100 FROM pg_settings WHERE name = 'server_version_num') = 904 THEN
47-
CREATE EXTENSION IF NOT EXISTS pglogical_origin;
48-
END IF;
49-
END;$$;
5043
SELECT * FROM pglogical.create_node(node_name := 'test_subscriber', dsn := (SELECT subscriber_dsn FROM pglogical_regress_variables()) || ' user=super');
5144
create_node
5245
-------------

pglogical.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,11 +371,7 @@ pglogical_supervisor_main(Datum main_arg)
371371
PGLogicalCtx->connections_changed = true;
372372

373373
/* Setup connection to pinned catalogs (we only ever read pg_database). */
374-
#if PG_VERSION_NUM >= 90500
375374
BackgroundWorkerInitializeConnection(NULL, NULL);
376-
#else
377-
BackgroundWorkerInitializeConnection("postgres", NULL);
378-
#endif
379375

380376
/* Main wait loop. */
381377
while (!got_SIGTERM)

pglogical.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
#include "pglogical_fe.h"
2323
#include "pglogical_node.h"
2424

25-
#if PG_VERSION_NUM < 90500
26-
#include "pglogical_compat.h"
27-
#endif
28-
2925
#define PGLOGICAL_VERSION "1.0.1"
3026
#define PGLOGICAL_VERSION_NUM 10001
3127

pglogical_apply.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,7 @@ UserTableUpdateOpenIndexes(EState *estate, TupleTableSlot *slot)
294294
List *recheckIndexes = NIL;
295295
recheckIndexes = ExecInsertIndexTuples(slot,
296296
&slot->tts_tuple->t_self,
297-
estate
298-
#if PG_VERSION_NUM >= 90500
299-
, false, NULL, NIL
300-
#endif
301-
);
297+
estate, false, NULL, NIL);
302298

303299
/* FIXME: recheck the indexes */
304300
if (recheckIndexes != NIL)
@@ -417,11 +413,7 @@ handle_insert(StringInfo s)
417413
ExecSetSlotDescriptor(localslot, RelationGetDescr(rel->rel));
418414
ExecSetSlotDescriptor(applyslot, RelationGetDescr(rel->rel));
419415

420-
ExecOpenIndices(estate->es_result_relation_info
421-
#if PG_VERSION_NUM >= 90500
422-
, false
423-
#endif
424-
);
416+
ExecOpenIndices(estate->es_result_relation_info, false);
425417

426418
conflicts = pglogical_tuple_find_conflict(estate, &newtup, localslot);
427419

@@ -616,11 +608,7 @@ handle_update(StringInfo s)
616608
/* Only update indexes if it's not HOT update. */
617609
if (!HeapTupleIsHeapOnly(applyslot->tts_tuple))
618610
{
619-
ExecOpenIndices(estate->es_result_relation_info
620-
#if PG_VERSION_NUM >= 90500
621-
, false
622-
#endif
623-
);
611+
ExecOpenIndices(estate->es_result_relation_info, false);
624612
UserTableUpdateOpenIndexes(estate, applyslot);
625613
ExecCloseIndices(estate->es_result_relation_info);
626614
}

pglogical_functions.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,7 @@ pglogical_drop_node(PG_FUNCTION_ARGS)
222222
continue;
223223
}
224224

225-
#if PG_VERSION_NUM < 90500
226-
if (slot->active)
227-
#else
228225
if (slot->active_pid != 0)
229-
#endif
230226
{
231227
SpinLockRelease(&slot->mutex);
232228
LWLockAcquire(ReplicationSlotControlLock, LW_SHARED);
@@ -1192,11 +1188,7 @@ pglogical_replicate_ddl_command(PG_FUNCTION_ARGS)
11921188
/* Force everything in the query to be fully qualified. */
11931189
(void) set_config_option("search_path", "",
11941190
PGC_USERSET, PGC_S_SESSION,
1195-
GUC_ACTION_SAVE, true, 0
1196-
#if PG_VERSION_NUM >= 90500
1197-
, false
1198-
#endif
1199-
);
1191+
GUC_ACTION_SAVE, true, 0, false);
12001192

12011193
/* Convert the query to json string. */
12021194
initStringInfo(&cmd);
@@ -1212,12 +1204,7 @@ pglogical_replicate_ddl_command(PG_FUNCTION_ARGS)
12121204
QUEUE_COMMAND_TYPE_SQL, cmd.data);
12131205

12141206
/* Execute the query locally. */
1215-
pglogical_execute_sql_command(query, GetUserNameFromId(GetUserId()
1216-
#if PG_VERSION_NUM >= 90500
1217-
, false
1218-
#endif
1219-
),
1220-
false);
1207+
pglogical_execute_sql_command(query, GetUserNameFromId(GetUserId(), false), false);
12211208

12221209
/*
12231210
* Restore the GUC variables we set above.

pglogical_queue.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,7 @@ queue_message(List *replication_sets, Oid roleoid, char message_type,
7777
const char *role;
7878
TimestampTz ts = GetCurrentTimestamp();
7979

80-
role = GetUserNameFromId(roleoid
81-
#if PG_VERSION_NUM >= 90500
82-
, false
83-
#endif
84-
);
80+
role = GetUserNameFromId(roleoid, false);
8581

8682
rv = makeRangeVar(EXTENSION_NAME, CATALOG_QUEUE, -1);
8783
rel = heap_openrv(rv, RowExclusiveLock);

pglogical_sync.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,7 @@
5959

6060
#define CATALOG_LOCAL_SYNC_STATUS "local_sync_status"
6161

62-
#if PG_VERSION_NUM < 90500
63-
#define PGDUMP_BINARY "pglogical_dump"
64-
#else
6562
#define PGDUMP_BINARY "pg_dump"
66-
#endif
6763
#define PGRESTORE_BINARY "pg_restore"
6864

6965
#define Natts_local_sync_state 5
@@ -98,7 +94,7 @@ dump_structure(PGLogicalSubscription *sub, const char *destfile,
9894
PG_VERSION_NUM / 100 / 100, PG_VERSION_NUM / 100 % 100);
9995

10096
initStringInfo(&command);
101-
appendStringInfo(&command, "%s --snapshot=\"%s\" -s -N %s -N pglogical_origin -F c -f \"%s\" \"%s\"",
97+
appendStringInfo(&command, "%s --snapshot=\"%s\" -s -N %s -F c -f \"%s\" \"%s\"",
10298
pg_dump, snapshot, EXTENSION_NAME, destfile,
10399
sub->origin_if->dsn);
104100

pglogical_worker.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,6 @@ pglogical_worker_attach(int slot)
167167
{
168168
Assert(slot < PGLogicalCtx->total_workers);
169169

170-
#if PG_VERSION_NUM < 90600
171-
set_latch_on_sigusr1 = true;
172-
#endif
173-
174170
LWLockAcquire(PGLogicalCtx->lock, LW_EXCLUSIVE);
175171

176172
before_shmem_exit(pglogical_worker_on_exit, (Datum) 0);

sql/init.sql

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,14 @@ GRANT ALL ON SCHEMA public TO nonsuper;
3939

4040
\c :provider_dsn
4141
SET client_min_messages = 'warning';
42-
CREATE EXTENSION IF NOT EXISTS pglogical VERSION '1.0.0';
43-
ALTER EXTENSION pglogical UPDATE;
42+
CREATE EXTENSION IF NOT EXISTS pglogical;
4443

4544
SELECT * FROM pglogical.create_node(node_name := 'test_provider', dsn := (SELECT provider_dsn FROM pglogical_regress_variables()) || ' user=super');
4645

4746
\c :subscriber_dsn
4847
SET client_min_messages = 'warning';
4948
CREATE EXTENSION IF NOT EXISTS pglogical;
5049

51-
DO $$
52-
BEGIN
53-
IF (SELECT setting::integer/100 FROM pg_settings WHERE name = 'server_version_num') = 904 THEN
54-
CREATE EXTENSION IF NOT EXISTS pglogical_origin;
55-
END IF;
56-
END;$$;
57-
5850
SELECT * FROM pglogical.create_node(node_name := 'test_subscriber', dsn := (SELECT subscriber_dsn FROM pglogical_regress_variables()) || ' user=super');
5951

6052
BEGIN;

0 commit comments

Comments
 (0)