Re: Have psql show current sequnce values - (Resubmission) - Mailing list pgsql-patches

From Tom Lane
Subject Re: Have psql show current sequnce values - (Resubmission)
Date
Msg-id 11107.1157398380@sss.pgh.pa.us
Whole thread Raw
In response to Re: Have psql show current sequnce values - (Resubmission)  (Dhanaraj M <Dhanaraj.M@Sun.COM>)
Responses Re: [HACKERS] Have psql show current sequnce values - (Resubmission)  (Bruce Momjian <bruce@momjian.us>)
List pgsql-patches
Dhanaraj M <Dhanaraj.M@Sun.COM> writes:
> Sorry for resubmitting this patch.
> Just now I found a problem.
> Instead of assigning initial sequence value to 1,
> I assign LLONG_MAX to avoid the buffer overflow problem.
> Please find the current version here.

This patch is a mess.  In the first place, it's completely unkosher for
an application to scribble on a PGresult's contents, even if you do take
steps like the above to try to make sure there's enough space.  But said
step does not work anyway -- LLONG_MAX might not exist on the client, or
might exist but be smaller than the server's value.

Another problem with it is it's not schema-aware and not proof against
quoting requirements for the sequence name (try it with a mixed-case
sequence name for instance).  It also ought to pay some attention to
the possibility that the SELECT for last_value fails --- quite aside
from communication failure or such, there might be a permissions problem
preventing the last_value from being read.

            regards, tom lane

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: setseed() doc
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Interval month, week -> day