apgdiff icon indicating copy to clipboard operation
apgdiff copied to clipboard

DROP then CREATE triggers

Open miccies4 opened this issue 7 years ago • 6 comments

apgdiff doesn't recognize two dumps of different pg version, issue occurs when comparing 9.6.6 and 9.6.10 and 10.3 dump versions, it drops then creates triggers, also alters tables and sequences. That's most likely parsing issue and has something to do with differnces in adding schema to objects names. Has anyone solved that ?

miccies4 avatar Sep 03 '18 12:09 miccies4

that might really be related to adding schema names to object names. but i did not look into the code. i don't know how large your dump is but you might try to adjust the dump from 10.3 to remove the schema names and instead place them in the dump as it is done in previous versions. if apgdiff handles that correctly, it's obvious that the issue is related to the schema names. if your dumps are large, you can try this test just on a fragment of the dumps.

fordfrog avatar Sep 18 '18 07:09 fordfrog

That's true, and I've done all these things. Apgdiff works perfectly fine, when dumps are absolutely identical, all manual correction are possible, as you noticed, in small dumps, there you only have one, maybe two tables, triggers, etc. However it becomes practically impossible, or impractical to say at least, to adjust all schemas in all names when I'm working on big production database. So on the matter itself, I am comparing two "identical" dumps, the only thing that differs is the schema name. It has troubles comparing two databases of different pg version, for example, if you have the same database, but in version 10.3 and 9.6.10 or 9.6.6 and 9.6.10 etc, The schema placement is different, sometimes object name is preceded by schema name and sometimes is not (same objects, different version). Taking all those things under consideration, I would like apgdiff to "understand" that, even tho there is a schema before identical object in one version and there is not in other identical object, they're still, basically the same. Or maybe adding the same schema automatically to all objects could be possible ? Sorry for the lenght of my message, but I hope that you understand what's the issue now. Do you have any ideas how to solve my problem ? Or maybe it's impossible to do what I want to be done, using apgdiff. Kind regards, Michal

wt., 18 wrz 2018 o 09:43 fordfrog [email protected] napisał(a):

that might really be related to adding schema names to object names. but i did not look into the code. i don't know how large your dump is but you might try to adjust the dump from 10.3 to remove the schema names and instead place them in the dump as it is done in previous versions. if apgdiff handles that correctly, it's obvious that the issue is related to the schema names. if your dumps are large, you can try this test just on a fragment of the dumps.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fordfrog/apgdiff/issues/242#issuecomment-422289477, or mute the thread https://github.com/notifications/unsubscribe-auth/Ao8tMDHj_w9v65tPj-pqf4m6MAFQhhesks5ucKQqgaJpZM4WXk56 .

miccies4 avatar Sep 18 '18 09:09 miccies4

so you confirm it is because of the dump format in pg10?

fordfrog avatar Sep 18 '18 10:09 fordfrog

Well, I do, but it's most likely more complexed. Those changes were officially introduced in pg10, but after that they were also applied to version marked as 9.6.10, so it's a little bit tricky. I hope that's not a problem, but I attatched dumps in 3 mentioned versions, they're all parts of my actual db. What I noticed is that, when I only use this object bunker once in my function, it's ok, no matter if it has schema or not, but when I use it more than once like I do in TRIGGER ( CREATE TRIGGER upd_dt_bunker BEFORE UPDATE ON sw.bunker FOR EACH ROW EXECUTE PROCEDURE sw.before_update(); ) or CONTRAINT that uses foreign keys are the biggest problem here. Apgdiff sees them as different objects. I would be absolutely grateful if You could compare them. Thanks in advance! One more thing worth mentioning, is that I already solved PARISNG problem, and now it's parsing even with more than one " . " Kind regards, Michal Cieslinski

wt., 18 wrz 2018 o 12:16 fordfrog [email protected] napisał(a):

so you confirm it is because of the dump format in pg10?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/fordfrog/apgdiff/issues/242#issuecomment-422337173, or mute the thread https://github.com/notifications/unsubscribe-auth/Ao8tMEObCrf1SU4tTaRucio_IVOcnjnCks5ucMfqgaJpZM4WXk56 .

miccies4 avatar Sep 18 '18 11:09 miccies4

Test with this jar diff.zip

jalissonmello avatar Nov 24 '18 14:11 jalissonmello

Now in release the folder its the jar version 2.6.0

jalissonmello avatar Feb 21 '19 23:02 jalissonmello