Please find the attached patch, which uses the same approach as mentioned in previous email to implement input functions to parse pg_distinct, pg_dependency and pg_mcv_list strings.
Regards,
Hari
From: Bruce Momjian <bruce@momjian.us> Date: Saturday, 7 January 2023 at 8:10 AM To: Hari krishna Maddileti <hmaddileti@vmware.com> Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org> Subject: Re: Support for dumping extended statistics
!! External Email
On Thu, Jan 5, 2023 at 06:29:03PM +0000, Hari krishna Maddileti wrote: > Hi Team, > In order to restore dumped extended statistics (stxdndistinct, > stxddependencies, stxdmcv) we need to provide input functions to parse > pg_distinct/pg_dependency/pg_mcv_list strings. > > Today we get the ERROR "cannot accept a value of type pg_ndistinct/ > pg_dependencies/pg_mcv_list" when we try to do an insert of any type. > > Approch tried: > > - Using yacc grammar file (statistics_gram.y) to parse the input string to its > internal format for the types pg_distinct and pg_dependencies > > - We are just calling byteain() for serialized input text of type pg_mcv_list. > > Currently the changes are working locally, I would like to push the commit > changes to upstream if there any usecase for postgres. Would like to know if > there any interest from postgres side.
There is certainly interest in allowing the optimizer statistics to be dumped and reloaded. This could be used by pg_restore and pg_upgrade.