magic constant -1

View: New views
3 Messages — Rating Filter:   Alert me  

magic constant -1

by Pavel Stehule :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

we use a value -1 as two values: a) unknown typmod, b) unknown
location. Can we substitute it by some better identifier?

Maybe: UnknownTmod, UnknownLoc ... UnspecTmd, UnspecLoc???

Regards
Pavel Stehule

--
Sent via pgsql-hackers mailing list (pgsql-hackers@...)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: magic constant -1

by Tom Lane-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Pavel Stehule <pavel.stehule@...> writes:
> we use a value -1 as two values: a) unknown typmod, b) unknown
> location. Can we substitute it by some better identifier?

> Maybe: UnknownTmod, UnknownLoc ... UnspecTmd, UnspecLoc???

Doesn't really seem worth the trouble, especially since the checks
for "unspecified" are coded as negative/nonnegative rather than
simple equality.

                        regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@...)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Re: magic constant -1

by Pavel Stehule :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/11/5 Tom Lane <tgl@...>:
> Pavel Stehule <pavel.stehule@...> writes:
>> we use a value -1 as two values: a) unknown typmod, b) unknown
>> location. Can we substitute it by some better identifier?
>
>> Maybe: UnknownTmod, UnknownLoc ... UnspecTmd, UnspecLoc???
>
> Doesn't really seem worth the trouble, especially since the checks
> for "unspecified" are coded as negative/nonnegative rather than
> simple equality.

I worked on enhancing an area where typmod is used, and I had a small
problem - because it wasn't simply clean, where -1 is typmod or
location.

This should be an idea for enhancing and increasing code quality. -1
is probably last wide used magic constant in pg.

Pavel


>
>                        regards, tom lane
>

--
Sent via pgsql-hackers mailing list (pgsql-hackers@...)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers