Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iZ5Yu-0000Gc-JN for pgsql-docs@arkaria.postgresql.org; Mon, 25 Nov 2019 04:01:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iZ5Ys-0002kn-Lj for pgsql-docs@arkaria.postgresql.org; Mon, 25 Nov 2019 04:01:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iZ5Ys-0002kg-CF for pgsql-docs@lists.postgresql.org; Mon, 25 Nov 2019 04:01:18 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iZ5Yq-0005cb-0n for pgsql-docs@lists.postgresql.org; Mon, 25 Nov 2019 04:01:17 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 94ED75B2; Sun, 24 Nov 2019 23:01:13 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sun, 24 Nov 2019 23:01:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=qeLTPdivXB4qUMPd5z+KlTFPrkJ 9fpn0Tt3hxLKflfE=; b=k+PsQZ6hLNMada9vi2iOFEHPnXXTi6IbdpJ3Eyun4vj YF172ua0UBU0fdBRkUA3+LQNO4Xx23o5sk5SEqEQzkUo2Yw2AJojRq2cknC0XLH5 EmZFfiToPZ4FdjSbSVbHkCxRuso7x+kOXfe5mijHsFpR9BC+bEmDQgWWPPWqzT8+ gHcz6C8l+B/1rrltSGoXnJzg4i1FFtzDHKwFPkRHrUThIokY9zPwj3clGHpBcbw7 gROU4JJIyWs8rZSFGQp8dWdhIgDYWSsBf+hrdznu7yyWq89r9EXFmQYJ+pzREkKw GhYWus4mrUlrN/RUsa77ALZrgWe2nC4GQ5BAtisaNMA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=qeLTPd ivXB4qUMPd5z+KlTFPrkJ9fpn0Tt3hxLKflfE=; b=DJClfjbUK2qsv56/G5cMvw R2a6z4LRBY/6Zxi6CYswdzSxoJrIQnAetRnQgfiB32ljs+xNNyml07CQnXOsiFQw 8zc5/x8f2Kch5woOl9WrAaiksYbw7E2SyJ8rPAyQp5QZ8hgg42w0HjihspKl/mc8 k9+JiQTiPnxZNJYwjSiZfQAxAIcl9+8FZJqKoq+GKo5yJ9e6ysp5V9rpR0yF3XO7 z7LM0qahUddkKab32vmMwhupIskcgJ6lx/apcB4gOr2s3PAA15ZJ2VteItrmt8o2 4r8jxVAqWWSwrcYIiOe24MbN4JtmUXL663Qa33SlDPJeOEm1wTe4pzZirl1yGFxw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudeitddgtdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpeffhf fvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhu ihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucfkphepuddukedrvd eguddrvdegkedrudehfeenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhes phgrqhhuihgvrhdrgiihiienucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from paquier.xyz (mp76f1f899.ap.nuro.jp [118.241.248.153]) by mail.messagingengine.com (Postfix) with ESMTPA id 284198005A; Sun, 24 Nov 2019 23:01:10 -0500 (EST) Date: Mon, 25 Nov 2019 13:01:08 +0900 From: Michael Paquier To: mickey@thesweetoasis.com, pgsql-docs@lists.postgresql.org Subject: Re: documentation clarifications for "alter sequence" ? Message-ID: <20191125040108.GI37821@paquier.xyz> References: <157436678837.7231.16812037581107684403@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="IJFRpmOek+ZRSQoz" Content-Disposition: inline In-Reply-To: <157436678837.7231.16812037581107684403@wrigleys.postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --IJFRpmOek+ZRSQoz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Nov 21, 2019 at 08:06:28PM +0000, PG Doc comments form wrote: > -- it would be helpful if this interaction/ relation were explicitly pointed > out, and why it behaves this way. ("MINVALUE cannot be greater than START > value" makes more sense to me, since minvalue is the thing I'm attempting to > alter. Or even "START value must be at least MINVALUE", if in fact that's > the limitation.) Project style is usually to avoid full sentences in user-facing error messages, so an improvement may be something like that: cannot set MINVALUE to be higher or equal than START value. However, these error messages are actually as they are per the state of the code, whose goal is to be kept simple. If you look at init_params() in sequence.c, what happens is that an initial state of the sequence is taken, and then the parameters specified in *all* the sub-clauses of the query update the state of the sequence. Finally all the parameters are cross-checked, so you cannot actually know which parameter is being set. Note that trying to guess what is getting set and to inform that with more error messages would not be that helpful either if trying to update both parameters at the same time. For example what would you do here? ALTER SEQUENCE goo MINVALUE 4 START 1; > -- "Any parameters not specifically set in the ALTER SEQUENCE command > retain their prior settings". OK, but this does not seem intuitive, at least > to me. What meaning or use does a min value have after a restart? It simply means that non-updated parameters are left as they are originally. And minvalue/maxvalue are used depending on if the sequence is ascending/descending if CYCLE is enabled. If NO CYCLE is used they are used as sanity checks. > Also, "setval function" is mentioned. A link to that would be helpful. You can say the same about currval, lastval and nextval, no? -- Michael --IJFRpmOek+ZRSQoz Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl3bUgQACgkQnvQgOdby QH0tDg//R+WqU9iqyjupytDfFYiinol7Yh8uKDio2atr86KLFo1Io0gLqPvPZhMj sGJQqDkYsmZrF3p3IM3ZvnyNhlGNAUn4Z+g1apj0goxvJ1LrsJn8hLR0X4LqzoMn 2s/nSsMHN0dsm7GlrLZhK6d9Dzhub5fMwFokqAwpReMMlV/09NG8J/8s7Qb3nEv9 z2gRDmewylNfAfARiKoA6rQ28CWAGjuOK5MwGjeztG+1lW6QfYHuQpcF7Q1+BrHF erlQP5mKMxkeaUt03ObqQLReG7LwQBfWuoOHo+cpKExr13iiDWUEqybe25Bn0WSM F2VP9UKh2aHNx+qn/YLjiSBakZW+Xqsk1o8ZvUQmvU5lQgQmiXhMfWQcqo3wA3jj D6bKU3B2F7+aHoKSYqdhcGhIByn3JNaGOc5C+3UsRffBUOGIA/U9QPv3sdDqb2Qj k7GJ03PxIjfcJreZ3Z5490QKfkTEe/ZLa2WW9tq4+YmY3JdjrSVaquSXR+cRA1j7 MJrwEazTq4yvaEUL53eCTiYnRdN4LxwhhWv7VoR2R/QyM9yK6lwOHaAdt4nQvLhG rtwmiBVzaQSlFYKlefSLvdz5eKTMAurxxCT25fFxLb0CV24X9kRgJadtvD5+sNTW dM7dLwhZlqf8qlw5v1bKlvbqMavxCM0jmAeRZz941qVvKKNCm8s= =oQda -----END PGP SIGNATURE----- --IJFRpmOek+ZRSQoz--