Bharath Rupireddy <bharath.rupireddyforpostgres@xxxxxxxxx> writes: > On Fri, May 14, 2021 at 8:23 PM Tom Lane <tgl@xxxxxxxxxxxxx> wrote: >> One conceivable workaround is to do your insertions through a >> foreign table that doesn't even have the serial column, so that >> the INSERT command received by the remote server lacks that >> column and the default gets applied. Probably too messy though. > Then the serial column cannot be selected via the foreign table. Yeah, you'd probably need to use different tables for inserting and reading, which is why I called it messy. The idea you pointed to in Michael's blog might work though, ie make a local function that reaches over to the remote server to get a globally-valid next sequence value, and use that as the default expression of the foreign table. regards, tom lane