Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jYlTS-00016k-HI for pgsql-bugs@arkaria.postgresql.org; Wed, 13 May 2020 07:06:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jYlTQ-0006d8-JF for pgsql-bugs@arkaria.postgresql.org; Wed, 13 May 2020 07:06:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jYdpC-0002RZ-7H for pgsql-bugs@lists.postgresql.org; Tue, 12 May 2020 22:56:34 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jYdp5-0004cW-O5 for pgsql-bugs@lists.postgresql.org; Tue, 12 May 2020 22:56:33 +0000 Received: by mail-wm1-x344.google.com with SMTP id z72so16348164wmc.2 for ; Tue, 12 May 2020 15:56:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:references:in-reply-to:subject:date:message-id:mime-version :thread-index:content-language; bh=JwTfciumRwluCfMdRW0clGw0/BuGwHJmR+NEHQoZ/cE=; b=Z+kntKbPUoon2+B88fiAi2/37y362pZWXd7UcnRyy31+3B5QpHj38XTlLXLIeOWTqw AcIvN0pCtDGnVVn/Uzr5/LqfLwxYXNTBvNvylayBh2phJTIm1j8q0Rs6L6wJsCK9Irej pQxapm3vOhKnm14QvpXqs+/gjKirqgnR1yUFcROx8YvVz3LcruQT4Et8TCbuQQ/mGKx8 5SdMBTHuQ+JnGVZiPR5+CaK2fU6HlOWea4O060nSH6mmdlwFBeq2XTsFLxp2XSLVAiSx 1pln3K+R12iji4s5mO6eYVNQZ/0XgM96jeQZd7qD/I8T4BYDlYZRfZk3QFtBgxDwJ/em UOkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:references:in-reply-to:subject:date :message-id:mime-version:thread-index:content-language; bh=JwTfciumRwluCfMdRW0clGw0/BuGwHJmR+NEHQoZ/cE=; b=XqE+oLTBFQDPy9VfKBAXc73C8VEjb3YyapqkWIwnFpumLaVrLBI7eCrxQbLlLMG1n9 z9B8VafH4cIMz0sWonYBIlak5e8Czd8za1JUY8tlTL49DA8ob7e938LOMxZWkmgu1JJr 6oDfkka0Qyi78fRltRtOtGFRvjC6K+3VS6ULVfOeym65qGvxngi1Z8amuftBYr52YP+d X/0SUEAj64xvlb2wwcdxNQhF8ir3wGLdVC2HYScjRKbIg7Tfo/9Xavsg2dbvr2/L+MnR S7OGrnWZCw901EvzZ+wUFbgLB++oHPH2RjVOjU/EEsKUMJgSUb/1uzV6cxq4nsTK6WFm Jk0A== X-Gm-Message-State: AGi0PuZpZmgxGY4KV84LReKF8d3I3+k6tVRKvy2DfR7xumGGPnxl2U0t JP+oCpE7BqRSh/e5xzLlIlQ= X-Google-Smtp-Source: APiQypIMW8ys1iY2GsCQtbcLC20EZXxizBXozXTV/dT5XPHz6DEkKJRtwUrHILqbIrw6VBMo5k8VYw== X-Received: by 2002:a1c:4b0e:: with SMTP id y14mr12746651wma.170.1589324185942; Tue, 12 May 2020 15:56:25 -0700 (PDT) Received: from EMEA28197 (cpc78693-glfd7-2-0-cust116.6-2.cable.virginm.net. [81.110.75.117]) by smtp.gmail.com with ESMTPSA id q9sm9390098wmb.34.2020.05.12.15.56.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 May 2020 15:56:25 -0700 (PDT) From: To: "'David G. Johnston'" , References: <16430-f03b90a57994b00f@postgresql.org> In-Reply-To: Subject: RE: BUG #16430: Sequence with cache > 1 makes it increment by number specified as cache Date: Tue, 12 May 2020 23:56:23 +0100 Message-ID: <000401d628b0$8f5bedd0$ae13c970$@gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0005_01D628B8.F120CB00" X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQHysbmka5TD6MjyHIs02ry3llLUsgGLqbB8qF+eaaA= Content-Language: en-gb List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multipart message in MIME format. ------=_NextPart_000_0005_01D628B8.F120CB00 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable I am not sure. I was porting MS SQL code to Postgre. (I assumed it works = in MS SQL, but I haven=E2=80=99t checked, might be a bug) But now that I know that this cache is not shared between connections it = does not make sense to have cache more than max value (80k). =20 =20 -Valentinas =20 From: David G. Johnston =20 Sent: 12 May 2020 16:48 To: val.janeiko@gmail.com; pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16430: Sequence with cache > 1 makes it increment by = number specified as cache =20 On Tuesday, May 12, 2020, PG Bug reporting form > wrote: The following bug has been logged on the website: Bug reference: 16430 Logged by: Valentinas Email address: val.janeiko@gmail.com = PostgreSQL version: 12.2 Operating system: Alpine (container) Description: =20 When using Sequence inside a plpgsql function called using SELECT func() using Npgsql library a sequence is incremented by the value specified in CACHE. =20 That is a perfectly valid outcome per the meaning and documented usage = of cache in the server. =20 Additionally if CACHE is set to > 80000 (e.g. 100000) the query always returns 0. =20 Interesting...probably worth looking into even if a cache value that = large doesn=E2=80=99t make much sense usually. Doing and posting some = tests using just sql and psql would be a good start in isolating where = the discrepancy lies. =20 David J. ------=_NextPart_000_0005_01D628B8.F120CB00 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

I am not sure. I was porting MS SQL = code to Postgre. (I assumed it works in MS SQL, but I haven=E2=80=99t = checked, might be a bug)

But now that I know that this cache = is not shared between connections it does not make sense to have cache = more than max value (80k).

 

 

-Valentinas

 

From: David G. Johnston = <david.g.johnston@gmail.com>
Sent: 12 May 2020 = 16:48
To: val.janeiko@gmail.com; = pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16430: = Sequence with cache > 1 makes it increment by number specified as = cache

 

On Tuesday, = May 12, 2020, PG Bug reporting form <noreply@postgresql.org> = wrote:

The following bug has been logged on the = website:

Bug reference:      16430
Logged = by:          Valentinas
Email address:  =     val.janeiko@gmail.com
Postgr= eSQL version: 12.2
Operating system:   Alpine = (container)
Description:       

When = using Sequence inside a plpgsql function called using SELECT = func()
using Npgsql library a sequence is incremented by the value = specified in
CACHE.

 

That is a perfectly valid outcome per the meaning and = documented usage of cache in the server.

 

Additionally if CACHE is set to > 80000 (e.g. = 100000) the query always
returns = 0.

 

Interesting...probably worth looking into even if a = cache value that large doesn=E2=80=99t make much sense usually.  = Doing and posting some tests using just sql and psql would be a good = start in isolating where the discrepancy = lies.

 

David J.

------=_NextPart_000_0005_01D628B8.F120CB00--