$ php -v
PHP 7.1.6 (cli) (built: Jun 15 2017 22:22:41) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.1.6, Copyright (c) 1999-2017, by Zend Technologies
with Xdebug v2.5.3, Copyright (c) 2002-2017, by Derick Rethans
$ php -a
Interactive shell
php > echo 2000000014 - 2e9;
14
burik=# create table test (id serial not null primary key, value integer);
CREATE TABLE
burik=# alter sequence test_id_seq maxvalue 2;
ALTER SEQUENCE
burik=# insert into test (value) VALUES(1);
INSERT 0 1
burik=# insert into test (value) VALUES(2);
INSERT 0 1
burik=# insert into test (value) VALUES(3);
ERROR: nextval: reached maximum value of sequence "test_id_seq" (2)