Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OldTuple in UpdateMessage is nil ! #48

Open
seyedmo30 opened this issue Jan 28, 2023 · 2 comments
Open

OldTuple in UpdateMessage is nil ! #48

seyedmo30 opened this issue Jan 28, 2023 · 2 comments

Comments

@seyedmo30
Copy link

i copy and run logical exampe code , but after update , OldTuple print nil

	 case *pglogrepl.UpdateMessage:

			log.Printf("%+v  \n", logicalMsg.OldTuple)

print :

	{baseMessage:{msgType:85} RelationID:33230 OldTupleType:0 OldTuple:<nil> NewTuple:0xc0000650e0} 
@ubombi
Copy link
Contributor

ubombi commented Jan 31, 2023

works as intended.
@seyedmo30, You need to configure REPLICA IDENTITY for a table, to instruct PostgreSQL sending this data.

By default in OldTuple you will receive only primary key(s) and only if it was changed during update. Otherwise nil.

check this short explanation (promoting my project) and official docs.

if needed, example with index based replica identity.

@seyedmo30
Copy link
Author

@ubombi thanks a lot , it working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants