Bruce Momjian wrote:
> Tom Lane wrote:
> > I tried to repeat this:
> >
> > regression=# begin;
> > BEGIN
> > regression=# create table foo (f1 int);
> > CREATE
> > regression=# insert into foo [ ... some data ... ]
> >
> > regression=# analyze foo;
> > ERROR: ANALYZE cannot run inside a BEGIN/END block
> >
> > This seems a tad silly; I can't see any reason why ANALYZE couldn't be
> > done inside a BEGIN block. I think this is just a hangover from
> > ANALYZE's origins as part of VACUUM. Can anyone see a reason not to
> > allow it?
>
> The following patch allows analyze to be run inside a transaction.
> Vacuum and vacuum analyze still can not be run in a transaction.
One change in this patch is that because analyze now runs in the outer
transaction, I can't clear the memory used to support each analyzed
relation. Not sure if this is an issue.
-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610)
853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill,
Pennsylvania19026