Nathan Bossart <nathandboss...@gmail.com> writes:
> Okay, so are we okay to back-patch something like v1?  Or should we also
> return NULL for other sessions' temporary schemas on primaries?  That would
> change the condition to something like

>       char relpersist = seqrel->rd_rel->relpersistence;

>       if (relpersist == RELPERSISTENCE_PERMANENT ||
>               (relpersist == RELPERSISTENCE_UNLOGGED && 
> !RecoveryInProgress()) ||
>               !RELATION_IS_OTHER_TEMP(seqrel))
>       {
>               ...
>       }

Should be AND'ing not OR'ing the !TEMP condition, no?  Also I liked
your other formulation of the persistence check better.

> I personally think that would be fine to back-patch since pg_sequences
> already filters it out anyway.

+1 to include that, as it offers a defense if someone invokes this
function directly.  In HEAD we could then rip out the test in the
view.

BTW, I think you also need something like

-       int64           result;
+       int64           result = 0;

Your compiler may not complain about result being possibly
uninitialized, but IME others will.

                        regards, tom lane


Reply via email to