Repository navigation
Replies: 4 comments
|
Thanks for the suggestion, this is a good use case (clone a schema, mask data, and keep pre-created tables with custom storage parameters such as the compression method). I added a new conflict strategy for it: -- pre-create the table with your own storage parameters, then:
SELECT pgclone.table(conninfo, 'public', 't', true, 't', '{"conflict": "ignore"}');Note that data is appended, so re-running against a populated table will duplicate rows; truncate first if that matters. It will be available once the PR is merged and released. |
|
Thank you for this.
Note, I did not file a bug yet because I am not entirely sure but for
partitioned tables I have the impression the conflict option skip does not
work, could I be that you only check for the root table and not for the
partitions ? It behaves in fact as the conflict ignore optin that you
described just now in your mail.
And another thing, for release 4.5 (with Oracle table cloning), I could not
install it even if I made with without Oracle support, could it be that it
still checks on Oracle binaries in a default location and that it fails
when no Oracle client is installed ?
If I run into it when installing the newest version I will file a bug
report.
Thanks
Herwig
Op ma 16 nov 2026 om 17:45 schreef Valeh Agayev ***@***.***>:
… Thanks for the suggestion, this is a good use case (clone a schema, mask
data, and keep pre-created tables with custom storage parameters such as
the compression method).
I added a new conflict strategy for it: "conflict": "ignore" (PR #30
<#30>). If the target table
already exists, pgclone reports it with a NOTICE, leaves the existing
definition untouched (no CREATE TABLE, constraints, indexes or triggers)
and still loads the data. If the table does not exist it is created as
usual. Existing sequences are kept. It works in the sync (table, schema)
and async paths.
-- pre-create the table with your own storage parameters, then:SELECT pgclone.table(conninfo, 'public', 't', true, 't', '{"conflict": "ignore"}');
Note that data is appended, so re-running against a populated table will
duplicate rows; truncate first if that matters. It will be available once
the PR is merged and released.
—
Reply to this email directly, view it on GitHub
<#24?email_source=notifications&email_token=ACR3SXVTC3GYLZ47N4XCETD5ZMVI3A5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOJWGU4DSMJWUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVRTG633UMVZF6Y3MNFRWW#discussioncomment-19658916>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACR3SXRT7NCWO7JPL2Q4ADD5ZMVI3AVCNFSNUABJKJSXA33TNF2G64TZHMYTCOJWGU3DEMBZGA5UI2LTMN2XG43JN5XDWMJQHE3TMNJSG2QXMAQ>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/ACR3SXX42Y6ECVAA6BKJTNL5ZMVI3A5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOJWGU4DSMJWUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVJTG633UMVZF62LPOM>
and Android
<https://github.com/notifications/mobile/android/ACR3SXRRWNPOCJGU6WTIXIT5ZMVI3A5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOJWGU4DSMJWUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
Thanks for the follow-up. I tried One thing that could explain what you see: if your pre-created target partitions have different names from the source partitions, pgclone does not find them, so it treats the source partitions as new tables, creates them as standalone tables and loads data into them. Could you tell me the partition names on the source and on your pre-created target, and the pgclone version and PostgreSQL version? A While checking this I found a separate problem: cloning a schema that contains a partitioned table fails on an empty target ( Re the install problem on 4.5: that is tracked in #35. I could not reproduce it on a plain non-Oracle build; the likely cause is the old library still loaded in the running server, so restart PostgreSQL after |
|
You are right,
The partition names on source and target are indeed (slightly) different,
on the source a colleague of mine recently partitioned the table but gave
slightly different names so that explains it.
thanks.
Herwig
Op di 17 nov 2026 om 10:29 schreef Valeh Agayev ***@***.***>:
… Thanks for the follow-up. I tried conflict=skip on a partitioned schema
(PG18): when the target already has the partitioned parent and partitions
with the *same names* as the source, all of them are skipped and no data
is loaded. So I could not reproduce skip behaving like ignore in that
case.
One thing that could explain what you see: if your pre-created target
partitions have *different names* from the source partitions, pgclone
does not find them, so it treats the source partitions as new tables,
creates them as standalone tables and loads data into them. Could you tell
me the partition names on the source and on your pre-created target, and
the pgclone version and PostgreSQL version? A \d+ of the parent on both
sides would be ideal.
While checking this I found a separate problem: cloning a schema that
contains a partitioned table fails on an empty target (cannot copy from
partitioned table) and the parent is created as a plain table. I opened
#38 <#38> for that.
Re the install problem on 4.5: that is tracked in #35
<#35>. I could not reproduce it
on a plain non-Oracle build; the likely cause is the old library still
loaded in the running server, so restart PostgreSQL after make install
and before ALTER EXTENSION pgclone UPDATE.
—
Reply to this email directly, view it on GitHub
<#24?email_source=notifications&email_token=ACR3SXT4Y5Z77LYP46Z4MOL5ZQLABA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOJWG42TQOBRUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVRTG633UMVZF6Y3MNFRWW#discussioncomment-19675881>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACR3SXUUKNETQIX5XIADAHL5ZQLABAVCNFSNUABJKJSXA33TNF2G64TZHMYTCOJWGU3DEMBZGA5UI2LTMN2XG43JN5XDWMJQHE3TMNJSG2QXMAQ>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/ACR3SXUPXY5DZQFARBJ5X3T5ZQLABA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOJWG42TQOBRUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVJTG633UMVZF62LPOM>
and Android
<https://github.com/notifications/mobile/android/ACR3SXQY2TDDJRSNYIS4QT35ZQLABA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOJWG42TQOBRUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Uh oh!
There was an error while loading. Please reload this page.
When cloning a table or schema you can specify different conflict strategies. However the conflict strategy applies to DDL as well as to data. The default behaviour of psql is to continue on error. I have a use case that I want to clone a schema, mask data and change the storage parameters of some tables for example compression method. But right now I cannot do this with pgclone. Either pclone returns an error, skips the table and data, renames ir or replaces it. But I do not have an option to ignore for instance. ignore would report the error and continue with the data loadig or the next table. would this be possible ?
All reactions