Re: Use an enum for RELKIND_*? - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Use an enum for RELKIND_*?
Date
Msg-id 201901161710.wvm7nayw5xcv@alvherre.pgsql
Whole thread Raw
In response to Re: Use an enum for RELKIND_*?  (Greg Stark <stark@mit.edu>)
Responses Re: Use an enum for RELKIND_*?  (Greg Stark <stark@mit.edu>)
List pgsql-hackers
On 2018-Dec-21, Greg Stark wrote:

> But I had a second look to see if the output pointed out any actual
> bugs. I found one though it's pretty minor:
> 
> lockfuncs.c:234:3: warning: enumeration value
> ‘LOCKTAG_SPECULATIVE_TOKEN’ not handled in switch [-Wswitch-enum]
>    switch ((LockTagType) instance->locktag.locktag_type)
>    ^~~~~~
> 
> It just causes speculative locks to be printed wrong in the
> pg_lock_status view.

So what's a good fix?  We can add a new case to the switch.  Reporting
the XID is easy since we have a column for that, but what to do about
the uint32 value of the token?  We could put it in the virtualxid column
(which is just text), or we could put it in some int32 column and let it
show as negative; or we could add a new column.

Or we could do nothing, since there are no complaints about this
problem.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [HACKERS] generated columns
Next
From: John Naylor
Date:
Subject: Re: WIP: Avoid creation of the free space map for small tables