Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFE] Add MAX_INT constants #51

Closed
robrwo opened this issue Jun 27, 2019 · 4 comments
Closed

[RFE] Add MAX_INT constants #51

robrwo opened this issue Jun 27, 2019 · 4 comments

Comments

@robrwo
Copy link

robrwo commented Jun 27, 2019

It would be nice to have a :max set of constants to import, so that code could use these to validate numeric types before passing them into queries, e.g.

use constant MIN_SMALLINT => -32768;
use constant MAX_SMALLINT => 32767;
use constant MIN_INT  => -2147483648;
use constant MAX_INT => 2147483647;
...

I'm unsure how to handle bigints for this, though.

See https://www.postgresql.org/docs/11/datatype-numeric.html

@turnstep
Copy link
Contributor

I'm fine with this idea. Although a quick implementation attempt has revealed an issue in how we do our exporting, so will have to wait until I can circle back to it.

@turnstep
Copy link
Contributor

Okay, did some cleanup and implemented a proof of concept here: 5298fac

@robrwo
Copy link
Author

robrwo commented Jul 24, 2019

Thanks, this looks good.

@turnstep
Copy link
Contributor

Closing: this is live now; added in 3.9.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants