Nikhil Shetty <nikhil.dba04@xxxxxxxxx> writes: > Yes both the extension and function are created by the extension but when > restoring, extension and associated functions or tables are created > separately and in different order . Ah, right, I'd momentarily forgotten that binary-upgrade mode dumps the extensions' contents as separate objects. I think that switching the function(s) to new-style syntax, as already mentioned, might get you pretty far. It'd be enough for pg_dump to get the function-vs-spatial_ref_sys-existence ordering right at least. What it will not do is ensure that the *contents* of spatial_ref_sys are restored early. But I'm not sure that that's fatal in a binary-upgrade situation, because we're not dumping/restoring data: the tables' disk files are just moved verbatim. There might still be some edge cases that fail, but I think basic scenarios ought to work. regards, tom lane