Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sbLU1-00Fv6r-2B for pgsql-general@arkaria.postgresql.org; Tue, 06 Aug 2024 14:48:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sbLTz-000PD9-KA for pgsql-general@arkaria.postgresql.org; Tue, 06 Aug 2024 14:48:15 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sbLTz-000PCu-8J for pgsql-general@lists.postgresql.org; Tue, 06 Aug 2024 14:48:15 +0000 Received: from mail-oa1-x36.google.com ([2001:4860:4864:20::36]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sbLTw-003ORl-M9 for pgsql-general@lists.postgresql.org; Tue, 06 Aug 2024 14:48:14 +0000 Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-260f033fda3so422657fac.3 for ; Tue, 06 Aug 2024 07:48:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722955692; x=1723560492; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Z9VDpOi31xAN/ceNeL3FDr3K+9Z4ODE0moclJXA4x88=; b=X4BX/E0yzPVVD1gRmNwjZ6NhSgXZDut0AhIFYNOwE9xcrJz0xrLlLtkm7/G7g//hYI YtSwlcjZa8/qW/SNkBu3VXARDu1Yck25Hrg8kVdPNlSjqNrNfHE8sUKtCLyYrqmFishr 0y0DQ4TcG9xx+fUnkDoYGSTFbqVoK4UZq8KpQxQ6MNJg0fuEHatUOPp74Jf2RiMBQote hKmxbv4Zm5uT3yfEQYEFAPstupW15etO3U3sUkGXk35UnDAg16e9jEAesyYW176qprgr KNkM8j+fqkdJvNV/wYHMOxM+5SKiu/tYRRky4cYKZ5gMwsaOzALMTHCYnYgkCmzaP2DU lnag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722955692; x=1723560492; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z9VDpOi31xAN/ceNeL3FDr3K+9Z4ODE0moclJXA4x88=; b=SGUCOewHGJEep9eIWHWVHBn5crf064pIRYsUgIzwPjBj3FeFR0mH4kN137BSlv4OrY bXJowpaPpzFpn3PTjetV+Oa61GBmB4zMKy/w+1MXhmB8VvA6/WRKe3bdHba3soAAlKdb JZOyr8/j9LaBR5tb8j45Y0z8pXi1v6gxSYsZYvp3s5/adNKUeYiUNA3l1TPCfwT7FSqd W0taob1tDdxCD/QmHTm2MzJ4fG7ljicmokho8h5kqs/OoBanrznWqComCcU5GQUqHFso wCpKrq+bKFldl85S8p7QZWi0vgEzgFnkvysvDmim4UCLWZXs1VOhDoM09hJEr/hoaHJD NZ8A== X-Gm-Message-State: AOJu0Yz4YK6Yk2f8R0N+E9rfu6jQHI77vNzY05gHGnXfWdzzaXDQ6hUu VM82o0M4av9mN6Oi7/XG0aL2kpETUQ470g7so0Ew53nLviHmGhnsPjNiQT16ez/OGrNJ1Fy17Mr qVCWsXwwNEcNf1Eebn03e8Ef0EuFYMg== X-Google-Smtp-Source: AGHT+IF+TL4vxGulYpBK72RrnGyyp7VXHaOOypU25nkOhwHgIC7MIqUPBYanbSWT96iCRFryzIq7UlIRtworEM+f+Ps= X-Received: by 2002:a05:6870:4693:b0:260:e6a6:396c with SMTP id 586e51a60fabf-26891d5aebfmr19055566fac.30.1722955691934; Tue, 06 Aug 2024 07:48:11 -0700 (PDT) MIME-Version: 1.0 References: <1340430.1722954664@sss.pgh.pa.us> In-Reply-To: <1340430.1722954664@sss.pgh.pa.us> From: Dominique Devienne Date: Tue, 6 Aug 2024 16:48:00 +0200 Message-ID: Subject: Re: libpq version macro to use or not PQsocketPoll To: Tom Lane Cc: pgsql-general@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Aug 6, 2024 at 4:31=E2=80=AFPM Tom Lane wrote: > Dominique Devienne writes: > > Hi. Now that v17beta2 is part of my dev-env, I'm trying out the new API= . > > And I discover there's no version macro for conditional compilation in = LIBPQ... > > Indeed, that's an oversight, and there's a number of other things > we added to libpq-fe.h between 16 and 17 that probably deserve > their own LIBPQ_HAS symbols. OK, thanks. Glad to know they'll be in beta3 or the final release. > > I'm not sure what's so wrong with version macro as such. > A couple of things: > * It doesn't help if we forget to update it, so it's not really > better than HAS_ symbols on that score. I think it's easier to track/spot as part of the release process, and probably even automate it (or its checking). It's also a very common practice. If DRH does it for SQLite, then it has to be OK :) > * Usage is error-prone (you might test for the wrong cutoff version) > and not very readable. That's the client's responsibility. The "vendor" just has to increment/update the macros on every release. > * We can't retroactively make such a symbol appear in old copies > of libpq-fe.h. Sure. But we can start at some point. And eventually assume the macros exist, because older versions w/o them are no longer supported by your client code. And each client code base decides that. Again, the "vendor" just has to start defining the macros, and keep updating them. That's all. The rest is up to the client. My $0.02. I can use _HAS_ flags too. They are orthogonal in the first place, in fact. We can have both. Also, version macros don't multiply the way _HAS_ macros do, over time. It's neve too late to start adding them :). --DD