## Recovery with Postgresql logical replication

I’m using Postgresql 13 on Debian 10.6 and learning about logical replication.

I’ve set up logical replication with one publisher and one subscriber of one table. I’m wondering what my options are for recovering data (or rolling back) when, for example, someone accidentally does something on the publisher side like updating all the data in the table with the wrong value, or even deleting everything from a table. With logical replication these unintentional changes will of course be applied to the subscriber.

I’ve relentlessly searched online but have had no luck finding out what my options are.
I read about PITR but I’m thinking that’s suited more for physical replication, whereas I want to test rolling back changes on a specific database on a server.

## Problems with logical conjunction

There is a problem. I have line like this:
$$x in A backslash(Bbackslash C) leftrightarrow xin(Abackslash B)cup(Acap C)$$
and I tried to prove it from left, but stopped here:
$$xin A backslash(Bbackslash C)) leftrightarrow xin A wedge xnotin (Bbackslash C) leftrightarrow xin Abackslash(xnotin B wedge xin C) leftrightarrow ???$$
and tried from right, bout stopped here:
$$xin(Abackslash B)cup(Acap C) leftrightarrow (xin A wedge x notin B) vee (x in A wedge x in C) leftrightarrow x in A wedge (xnotin B vee xin C) leftrightarrow x in A wedge(x notin B lor x in C) leftrightarrow ???$$
So, to be honest, I’m kinda lost. I tried it two times, but still get different things from both sides. It is supposed to be "truth" and I need to show how to prove it. But I have no idea where is the mistake.

Also other question.
Is it correct to do something like this:
$$(xin A wedge x in B) wedge x notin Cleftrightarrow x in A wedge x notin C wedge x in B wedge x notin C$$
and if yes (or not) based on what? Because I tried to find something to base my prove on, but I can’t find anything specific, like theorem or definition.
If something isn’t clear, please say what, and I will try to clarify.

## development environment – Logical choice between VIM and Doom EMACS

I like the VIM Key bindings editing on VIM. I’ve researched online and found Doom Emacs EVIL mode can do “EVERYTHING” VIM can when it comes to writing code and productivity, plus more. Not really sure how accurate that is. If this is not true, then are the features not available in DOOM Emacs that is in VIM a deal breaker? I know Emacs is a whole ecosystem not just a text editor.

What are the reasons why I should choose VIM over Doom EMACS if Doom EMACS can do “Everything” VIM can.

All I want is a Dev environment for C, C++, Javascript and Python that boosts productivity and “lightwight”. At least lighter than VS Code, ATOM, Sublime Text or Notepad++.

## database design – Requesting review of my logical data model

I am working on a personal project and I want to make sure that my data model is correct and following the best practices. Receiving feedback on my data model is important in improving my ability and knowledge of databases.

I am designing a stock market program of sorts. My model for it is pretty simple.

The workflow of my project:

• A user creates a user account and enters their address
• A user then can create an account for a specific stock at a share and USD amount

My plan is to make the account table a type two table. Valid from will be set to the date the account was created and valid to will be initially null. Valid to will be set to current date once the account is closed.

## Investigating the Logical Compression of the Primes into the Prime Primes

The prime primes are the primes such that

Pp (pn is a prime with a novel prime difference p(n+1) – p(n) not found in all previous pi – pj)

Elucidating the Prime Prime Number Machine

Changeform Characterization Tab: The first 44774 primes are listed in column C, we track the difference between successive primes in column D and columns G – BL continually count whenever a specific prime difference is observed for a successive index of primes. Whenever we see a new difference for the first time we highlight that difference as it corresponds to a novel ‘epiphany generation’ that is, a list of prime differences following a novel prime difference prior to the following novel prime difference.

Changeforms Without Gaps Because 44774 lines in excel is unwieldy, we manually pull out the 50 lines that correspond to the 50 epiphany generations we’ve generated as a result of watching for those novel prime differences.

Epiphany Coefficients Here we take the difference from one row to the next so we understand which changeforms correspond to a SPECIFIC epiphany generation.

Epiphany Characterization Here we are investigating the properties of each epiphany generation but we can see that we have established fundamental information about the ‘entity understood of as the primes’ in the columns highlighted green (dark green being the specific coefficients for each chargeform which appears in an epiphany generation)

Finally in ‘Instantantious Decomposition Set’ We show that the prime numbers can be ‘factored (non-uniquely)’ additionally against a row of decision sets (-1, 0, 1) on a much more tightly bounded amount of prime primes. There are an extremely large amount of properties of this ’embedded arithmetic’ on various series.

The important thing to understand about epiphany generations is that they can literally be treated as a specific object which contains fundamental information about another object and can thus be used to parameterized predictions AHEAD OF TIME on a second travel through an algorithm which utilizes the information contained in an epiphany generation. The methodology generalizes to all series, but is most important here in the primes because it demonstrates that there is always a terminating path through a generation as long as you just have the set of changeforms which occur in that generation, which is much smaller than all of the potential changeforms.

Who sees an issue with this structure, and if there isn’t an issue, what do we think about the results?

## Logical Replication in PostgreSQL in opposite directions for different tables

I would like to know if it is possible to setup logical replication in opposite directions for different tables in PostgreSQL

That is

1. Data is replicated from DB1 Table1 -> DB2 Table 1
2. Data is replicated from DB2 Table2 -> DB1 Table 2


In the logic book I’m reading (Introduction to Logic by Patrick Suppes) some rules for formal definitions are established. The rules below are specified for a new operation symbol with equality:

An equivalence $$D$$ introducing a new n-place operation symbol $$O$$ is a proper definition in a theory if and only if $$D$$ is of the form:
$$O(v_1, …, v_n) = w leftrightarrow S$$
and the following restrictions are satisfied:
(i) $$v_1, …, v_n, w$$ are distinct variables.
(ii) $$S$$ has no free variables other than $$v_1, …, v_n, w$$.
(iii) $$S$$ is a formula in which the only non-logical constants are primitive symbols and previously defined symbols of the theory.
(iv) The formula $$exists !w(S)$$ is derivable from the axioms and preceding definitions of the theory.

There’s also mention of the Law of Identity:

If x is anything whatsoever, then $$x=x$$.

So, to stretch my understanding of these rules, I’ve made some elementary set theory definitions:

Note: Extentionality is assumed as part of the theory.
$$begin{array}{l} text{(1)}: A text{ is a relation } leftrightarrow forall v(v in A rightarrow exists x exists y(v = langle x,y rangle)) \ text{(2)}: v in A^c leftrightarrow A text{ is a relation } land exists x exists y (v = langle y,x rangle land langle x,y rangle in A)\ text{(3)}: f text{ is a function } leftrightarrow f text{ is a relation } land forall x forall y forall z (langle x,y rangle in f land langle x,z rangle in f rightarrow y=z) \ text{(4)}: f text{ is one-one } leftrightarrow f text{ is a function } land forall x forall y forall z (langle x,z rangle in f land langle y,z rangle in f rightarrow x=y) \ text{(5)}: x in f^{-1} leftrightarrow x in f^c land f^c text{ is one-one } \ text{(6)}: f(x) = y leftrightarrow f text{ is a function } land langle x,y rangle in f end{array}$$

However, after playing with those a bit (developing proofs of commonly known facts) I’ve noticed a problem. Within the bounds of this ruleset, it seems like one can use the Law of Identity to claim that $$f(x)=f(x)$$ and use that to claim that $$f$$ is a function, even though we know nothing about it. This is of course nonsense, as that logic can be used even with a variable that is not a function, leading to a contradiction.

The definition $$(6)$$ seems right, as from it you can prove that $$y$$ is unique. So my question is: What went wrong here?
Is my definition breaking any of the rules, am I missing some provisio on the Law of Identity, is the ruleset not complete, or is it something else entirely?

## What is the difference between the terms ‘Virtual’ and ‘Logical’?

What do people mean when they say ‘Logical’ in terms like Logical separation, Logical partition, Logical grouping etc. in software ? I know what ‘Virtual’ means, it means something that does not actually exist, a non existent ‘thing’ mapped to something that actually/physically exists. Does ‘Logical’ also mean the same ?

## database design – Is there a logical size limit to enum tables

I’m setting up a database to handle a FAQ page for different musical venues. The basic structure is:

``````id | venue_id | category | question | answer

``````

`category` links to an enum table so our app can allow users to filter questions. I am trying to decide if it makes sense to use an enum table for questions since all venues will be able to answer the same (optional) questions.

Our current design shows there could be around 200 total questions. Obviously this isn’t enough to cause any type of functional issue, but I am wondering if it is logical to have an enum table this large. What are the things that I should consider when making this decision?

Additionally, if questions are tied to a category would it make sense to eliminate the category all together in lieu of the question enum or is better not to bog a enum table down with more columns than neccessary?

## excel – Logical Expression with multiple True/False Statements

I’m having a hard time write a code that will display “Needs to Pay” or “Paid Up” once a certain sequence has occured.