From jarulraj@cs.cmu.edu Sun Aug 14 21:08:39 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZ2e7-0007ft-Hk for pgsql-general@arkaria.postgresql.org; Sun, 14 Aug 2016 21:08:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZ2e6-0005JO-VO for pgsql-general@arkaria.postgresql.org; Sun, 14 Aug 2016 21:08:39 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZ2bp-0002dH-28 for pgsql-general@postgresql.org; Sun, 14 Aug 2016 21:06:17 +0000 Received: from smtp01.srv.cs.cmu.edu ([128.2.217.200]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZ2bk-0001FY-CN for pgsql-general@postgresql.org; Sun, 14 Aug 2016 21:06:15 +0000 Received-SPF: none (cs.cmu.edu: No applicable sender policy available) receiver=smtp01.srv.cs.cmu.edu; identity=mailfrom; envelope-from="jarulraj@cs.cmu.edu"; helo=mail-ua0-f175.google.com; client-ip=209.85.217.175 Received: from mail-ua0-f175.google.com (mail-ua0-f175.google.com [209.85.217.175]) (authenticated bits=0) by smtp01.srv.cs.cmu.edu (8.13.6/8.13.6) with ESMTP id u7EL65YZ026398 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Sun, 14 Aug 2016 17:06:06 -0400 (EDT) Received: by mail-ua0-f175.google.com with SMTP id k90so50649374uak.1 for ; Sun, 14 Aug 2016 14:06:05 -0700 (PDT) X-Gm-Message-State: AEkooutFnhsQn+HBjmasYbZnp/0T1S3L6Kllxn++VozBSjalxAEyZTP/hLvTO6YyQHNwfZ7API77FPR0iCiLjA== X-Received: by 10.159.39.131 with SMTP id b3mr9428264uab.28.1471208765135; Sun, 14 Aug 2016 14:06:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.159.38.70 with HTTP; Sun, 14 Aug 2016 14:05:44 -0700 (PDT) From: Joy Arulraj Date: Sun, 14 Aug 2016 17:05:44 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: C++ port of Postgres To: pgsql-general@postgresql.org Content-Type: multipart/alternative; boundary=94eb2c123c84d62476053a0e7b90 X-Scanned-By: mimedefang-cmuscs on 128.2.217.200 X-Pg-Spam-Score: -4.8 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org --94eb2c123c84d62476053a0e7b90 Content-Type: text/plain; charset=UTF-8 Hi folks -- We have ported Postgres over to the C++ language (C++11 standard). https://github.com/jarulraj/postgresql-cpp Our goal is to use certain features of the C++ language and its standard library to simplify coding, improve code reuse, and avoid bugs. Peter's article titled `Moving to C++ ` was a source of inspiration for us. Regards. --94eb2c123c84d62476053a0e7b90 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi folks --

We have ported Postgres over= to the C++ language (C++11 standard).

https://github.com/jarulraj/postgresql-cpp
Our goal is to use certain features of the C++ language and its stand= ard library to simplify coding, improve code reuse, and avoid bugs. Peter&#= 39;s article titled `Moving to C++` was a source of inspiration for us.<= br>
Regards.
--94eb2c123c84d62476053a0e7b90-- From pierce@hogranch.com Sun Aug 14 21:26:10 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZ2v3-0000TG-Vy for pgsql-general@arkaria.postgresql.org; Sun, 14 Aug 2016 21:26:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZ2v2-00009Z-V7 for pgsql-general@arkaria.postgresql.org; Sun, 14 Aug 2016 21:26:08 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZ2sk-0005t7-8J for pgsql-general@postgresql.org; Sun, 14 Aug 2016 21:23:46 +0000 Received: from hogranch.com ([75.101.82.47]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZ2sg-0001Wp-7r for pgsql-general@postgresql.org; Sun, 14 Aug 2016 21:23:45 +0000 Received: from [192.168.0.2] (porker [192.168.0.2]) by hogranch.com (8.11.6/8.11.6) with ESMTP id u7ELNYv24834 for ; Sun, 14 Aug 2016 14:23:34 -0700 Subject: Re: C++ port of Postgres To: pgsql-general@postgresql.org References: From: John R Pierce Message-ID: Date: Sun, 14 Aug 2016 14:23:35 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------34611D7DB18B5EA15D95328C" X-HawgScanner-Information: Please contact the ISP for more information X-HawgScanner: Found to be clean X-Pg-Spam-Score: -2.4 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org This is a multi-part message in MIME format. --------------34611D7DB18B5EA15D95328C Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 8/14/2016 2:05 PM, Joy Arulraj wrote: > > We have ported Postgres over to the C++ language (C++11 standard). > > https://github.com/jarulraj/postgresql-cpp > > Our goal is to use certain features of the C++ language and its > standard library to simplify coding, improve code reuse, and avoid > bugs. Peter's article titled `Moving to C++ > ` was a > source of inspiration for us. does this compile with the non-GCC compilers that postgres gets built with, for instance, IBM XLC++ on AIX, Oracle Studio C++ on Solaris, Microsoft Visual C++ on MS Windows, CLang on BSD ? what about popular platforms like RHEL 6, where gcc is 4.4.7 ? -- john r pierce, recycling bits in santa cruz --------------34611D7DB18B5EA15D95328C Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 8/14/2016 2:05 PM, Joy Arulraj wrote:

We have ported Postgres over to the C++ language (C++11 standard).

https://github.com/jarulraj/postgresql-cpp

Our goal is to use certain features of the C++ language and its standard library to simplify coding, improve code reuse, and avoid bugs. Peter's article titled `Moving to C++` was a source of inspiration for us.

does this compile with the non-GCC compilers that postgres gets built with, for instance, IBM XLC++ on AIX, Oracle Studio C++ on Solaris, Microsoft Visual C++ on MS Windows, CLang on BSD ?   what about popular platforms like RHEL 6, where gcc is 4.4.7 ?



-- 
john r pierce, recycling bits in santa cruz
--------------34611D7DB18B5EA15D95328C-- From dmitigr@gmail.com Sun Aug 14 21:34:57 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZ33Z-00014O-4v for pgsql-general@arkaria.postgresql.org; Sun, 14 Aug 2016 21:34:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZ33Y-0000Yz-IQ for pgsql-general@arkaria.postgresql.org; Sun, 14 Aug 2016 21:34:56 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZ33X-0000Yq-Ur for pgsql-general@postgresql.org; Sun, 14 Aug 2016 21:34:56 +0000 Received: from mail-it0-x22c.google.com ([2607:f8b0:4001:c0b::22c]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZ33Q-0001j8-Bz for pgsql-general@postgresql.org; Sun, 14 Aug 2016 21:34:55 +0000 Received: by mail-it0-x22c.google.com with SMTP id i128so1614007itf.1 for ; Sun, 14 Aug 2016 14:34:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=douaPibBHEYlnNLoDurZ0DnCOi6wDi6UMlc0D2RLWb8=; b=JUAohC4nX10/wjQz/F5nWgyOkFkzYFVA7NWl3brTulg8/8Ia/hRmFnYnKjSPqSO2VX Z3Mx8ZRcuDLkgpSczihRLZ/98vTL8aOiaPYXE0pLyB5wuac4nZDgYxkq2KOJpj5Wid+a dxQm/GAR28n1cwRdxT/NcqoBZq18QTE+s538DPkr5LntAtJTMiXbZsIEly82d1A2UlD5 VRv3Xf4RJxjnJifSchaZjaD5kUUjT9b1p/GJEp23lxc6Owm3oFICWtLQ9pElE+LMFY21 TIeREngNkyQpRn72XIj0KW1NwrK3hieki4hSBjRikb94pmSyWLCqLuT4BA0ndX6/ecCH n0SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=douaPibBHEYlnNLoDurZ0DnCOi6wDi6UMlc0D2RLWb8=; b=ITAEX23prpfZtWYtulnxTfIBVHr7Cm4vBqIgcOxFG90XwzPZI620sWwv0NvtdeTTfQ x68eMsDjhILj1TFFBHpnl1zgNNVTHn8rqyyPh52qpzU9o8RjzwIQO0gsk8P/ZoBu8MTz yqGKC2C2v5oo6BA3uXcBy4imvtKprArb8FSnrZI+z2ytObXorwuClc5TWyt4Eo0Zl4Ux oMs554j/vgAGQvSIL4vdz3esFri2ravY5/6i+ncjzmhiBtu/VG+3dnyOCQLx/YvGdi6W k45ywTxXI7/88Zy8eDl1kbq56QtIR7YE5j7jwDgiQTTMNsJ3BvjV1aSItkrFoNRI2vdU 7kXA== X-Gm-Message-State: AEkooutByD+liN824CeOZyArbxwLQrxFIhs7zLpXyMRdBS3GXVQi+00P4wrkHt8zN6tuJH6G2b03ZHYAxhNJpQ== X-Received: by 10.36.71.67 with SMTP id t64mr10219862itb.0.1471210485764; Sun, 14 Aug 2016 14:34:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.38.70 with HTTP; Sun, 14 Aug 2016 14:34:45 -0700 (PDT) In-Reply-To: References: From: Dmitry Igrishin Date: Mon, 15 Aug 2016 00:34:45 +0300 Message-ID: Subject: Re: C++ port of Postgres To: Joy Arulraj Cc: "pgsql-general@postgresql.org" Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org Hi Joy, 2016-08-15 0:05 GMT+03:00 Joy Arulraj : > Hi folks -- > > We have ported Postgres over to the C++ language (C++11 standard). > > https://github.com/jarulraj/postgresql-cpp > > Our goal is to use certain features of the C++ language and its standard > library to simplify coding, improve code reuse, and avoid bugs. Peter's > article titled `Moving to C++` was a source of inspiration for us. What about the exceptions? Are you using them? -- // Dmitry. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general From jarulraj@cs.cmu.edu Sun Aug 14 22:08:29 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZ3a1-0002Pb-Ed for pgsql-general@arkaria.postgresql.org; Sun, 14 Aug 2016 22:08:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZ3Zz-0004A8-Nt for pgsql-general@arkaria.postgresql.org; Sun, 14 Aug 2016 22:08:27 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZ3Zy-00047k-Qr for pgsql-general@postgresql.org; Sun, 14 Aug 2016 22:08:26 +0000 Received: from smtp02.srv.cs.cmu.edu ([128.2.217.201]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZ3Zu-0002Ph-2V for pgsql-general@postgresql.org; Sun, 14 Aug 2016 22:08:25 +0000 Received-SPF: none (cs.cmu.edu: No applicable sender policy available) receiver=smtp02.srv.cs.cmu.edu; identity=mailfrom; envelope-from="jarulraj@cs.cmu.edu"; helo=mail-ua0-f171.google.com; client-ip=209.85.217.171 Received: from mail-ua0-f171.google.com (mail-ua0-f171.google.com [209.85.217.171]) (authenticated bits=0) by smtp02.srv.cs.cmu.edu (8.13.6/8.13.6) with ESMTP id u7EM8HbN016451 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Sun, 14 Aug 2016 18:08:18 -0400 (EDT) Received: by mail-ua0-f171.google.com with SMTP id 74so51815555uau.0 for ; Sun, 14 Aug 2016 15:08:17 -0700 (PDT) X-Gm-Message-State: AEkoousQIIzzVpRoWftMCSEGjh085drwGAk829OLPXrRYoKb399IcMmaUBYTU5L9lo+FEIdz8boXNJVZyqWlJA== X-Received: by 10.176.65.193 with SMTP id 59mr4757784uap.150.1471212497154; Sun, 14 Aug 2016 15:08:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.159.38.70 with HTTP; Sun, 14 Aug 2016 15:08:16 -0700 (PDT) Received: by 10.159.38.70 with HTTP; Sun, 14 Aug 2016 15:08:16 -0700 (PDT) In-Reply-To: References: From: Joy Arulraj Date: Sun, 14 Aug 2016 18:08:16 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: C++ port of Postgres To: Dmitry Igrishin Cc: pgsql-general@postgresql.org Content-Type: multipart/alternative; boundary=001a114a766c4839c1053a0f5a69 X-Scanned-By: mimedefang-cmuscs on 128.2.217.201 X-Pg-Spam-Score: -4.8 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org --001a114a766c4839c1053a0f5a69 Content-Type: text/plain; charset=UTF-8 Hi Dmitry -- We currently don't use exceptions, but we can certainly use them in the port. We can also use STL and smart pointers to simplify development and minimize memory bugs. On Aug 14, 2016 5:41 PM, "Dmitry Igrishin" wrote: > Hi Joy, > > 2016-08-15 0:05 GMT+03:00 Joy Arulraj : > > Hi folks -- > > > > We have ported Postgres over to the C++ language (C++11 standard). > > > > https://github.com/jarulraj/postgresql-cpp > > > > Our goal is to use certain features of the C++ language and its standard > > library to simplify coding, improve code reuse, and avoid bugs. Peter's > > article titled `Moving to C++` was a source of inspiration for us. > What about the exceptions? Are you using them? > > -- > // Dmitry. > --001a114a766c4839c1053a0f5a69 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Hi Dmitry -- We currently don't use exceptions, but we c= an certainly use them in the port. We can also use STL and smart pointers t= o simplify=C2=A0 development and minimize memory bugs.


On Aug 14, 2016 5= :41 PM, "Dmitry Igrishin" <dmitigr@gmail.com> wrote:
Hi Joy,

2016-08-15 0:05 GMT+03:00 Joy Arulraj <jarulraj@cs.cmu.edu>:
> Hi folks --
>
> We have ported Postgres over to the C++ language (C++11 standard).
>
> https://github.com/jarulraj/postgresql-cpp >
> Our goal is to use certain features of the C++ language and its standa= rd
> library to simplify coding, improve code reuse, and avoid bugs. Peter&= #39;s
> article titled `Moving to C++` was a source of inspiration for us.
What about the exceptions? Are you using them?

--
// Dmitry.
--001a114a766c4839c1053a0f5a69-- From kangjoni76@gmail.com Sun Aug 14 22:30:59 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZ3vn-0003Fy-Ct for pgsql-general@arkaria.postgresql.org; Sun, 14 Aug 2016 22:30:59 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZ3vm-0007NO-RC for pgsql-general@arkaria.postgresql.org; Sun, 14 Aug 2016 22:30:58 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZ3vm-0007NH-4T for pgsql-general@postgresql.org; Sun, 14 Aug 2016 22:30:58 +0000 Received: from mail-ua0-x22c.google.com ([2607:f8b0:400c:c08::22c]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZ3vj-0007A8-2n for pgsql-general@postgresql.org; Sun, 14 Aug 2016 22:30:56 +0000 Received: by mail-ua0-x22c.google.com with SMTP id k90so52113263uak.1 for ; Sun, 14 Aug 2016 15:30:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=9aoPDfDH0tOBoA3JfF3SxsheDvKwOHPuBDUOV9WxQY8=; b=oyQzkPBz7BFDjDeuNnCYyN8KFNS5pU/WddRmD+6caZwYLe1LinwNA6FjUTqJv0bcMy kwW9GSN5ajVWKq++dPpYDPGL15/eYcnWf9msLdh++96NbzpU6NyaqT7ZKNikTnjBxVRY uk4MPzDzIPYuh9KkkbEtN0BgnKMOCrhsmxBRVZfKrLMYP07zFybRydAp6CBys7KpF5BP APLVqa+tnMVsqc8ne69C3lr5Q/R6PSazPYN/CKy9JVIVPPza7cG5w4yioAtRPntAEb6o TsQG7YTZpGk0+hzM4Ib3wNugcs2mGZGydazoR9S5VFCmxPb5EHvr2b/Sf9R0qPTnccsh JkEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=9aoPDfDH0tOBoA3JfF3SxsheDvKwOHPuBDUOV9WxQY8=; b=PzLVX15JqKuzHBWTpnaRKsOR5O1mkdQqvXrhW3BikfHHAaN8SmSm3Jn9+3dRjwLlip JhiPrhCWaoMPdoKKYDJeBvB7Z92Pyvm8NhryuYghtbaEY0lzf+oZbIsMPTo2ouBYJ1oG Dw1plJ0dEThZzDtvTA3155fEXgqm/0cj27dygd9NN0j5AIF0qrjrNkzrVZ8Mtz0+7JcQ +uOoseb75xfAHjp7+lMgMmSit4u+mDtAoqTTx4qG9rLHH16zaR8isDowkKhJaCZiuKLH C42c4roVvN6nGHwDUY2B6TVl/saoAeoD7+9ydExdCx7HGPzE8PuYCNfeIXJPbv/aYJs3 Ewyg== X-Gm-Message-State: AEkoouu4fb/h/hoo97grkzMT7ufbM16ln+gD8/PboCrKaMVN4BNvYQsIsW7TrQJwFCk3i5PPV3zOUuqAUt/VEg== X-Received: by 10.31.147.142 with SMTP id v136mr12768369vkd.103.1471213853861; Sun, 14 Aug 2016 15:30:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.20.5 with HTTP; Sun, 14 Aug 2016 15:30:53 -0700 (PDT) In-Reply-To: References: From: kang joni Date: Mon, 15 Aug 2016 05:30:53 +0700 Message-ID: Subject: Re: C++ port of Postgres To: Joy Arulraj Cc: Dmitry Igrishin , pgsql-general@postgresql.org Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -1.8 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org I agree with this project, I dont like any setjmp/longjmp and the like. It just fighting against the nature of c++ language. Building either from scratch gcc48 or clang381 were easy nowdays on either old linux debian squeeze or centos 5. PS: I had this requirement circumtances. On 8/15/16, Joy Arulraj wrote: > Hi Dmitry -- We currently don't use exceptions, but we can certainly use > them in the port. We can also use STL and smart pointers to simplify > development and minimize memory bugs. > > On Aug 14, 2016 5:41 PM, "Dmitry Igrishin" wrote: > >> Hi Joy, >> >> 2016-08-15 0:05 GMT+03:00 Joy Arulraj : >> > Hi folks -- >> > >> > We have ported Postgres over to the C++ language (C++11 standard). >> > >> > https://github.com/jarulraj/postgresql-cpp >> > >> > Our goal is to use certain features of the C++ language and its >> > standard >> > library to simplify coding, improve code reuse, and avoid bugs. Peter's >> > article titled `Moving to C++` was a source of inspiration for us. >> What about the exceptions? Are you using them? >> >> -- >> // Dmitry. >> > -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general From jarulraj@cs.cmu.edu Sun Aug 14 23:43:34 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZ542-0006ZV-Ak for pgsql-general@arkaria.postgresql.org; Sun, 14 Aug 2016 23:43:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZ541-00082D-70 for pgsql-general@arkaria.postgresql.org; Sun, 14 Aug 2016 23:43:33 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZ51i-0005SN-Bd for pgsql-general@postgresql.org; Sun, 14 Aug 2016 23:41:10 +0000 Received: from smtp03.srv.cs.cmu.edu ([128.2.217.202]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZ51d-0004FD-F0 for pgsql-general@postgresql.org; Sun, 14 Aug 2016 23:41:08 +0000 Received-SPF: none (cs.cmu.edu: No applicable sender policy available) receiver=smtp03.srv.cs.cmu.edu; identity=mailfrom; envelope-from="jarulraj@cs.cmu.edu"; helo=mail-ua0-f182.google.com; client-ip=209.85.217.182 Received: from mail-ua0-f182.google.com (mail-ua0-f182.google.com [209.85.217.182]) (authenticated bits=0) by smtp03.srv.cs.cmu.edu (8.13.6/8.13.6) with ESMTP id u7ENf024004067 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Sun, 14 Aug 2016 19:41:01 -0400 (EDT) Received: by mail-ua0-f182.google.com with SMTP id 74so53404816uau.0 for ; Sun, 14 Aug 2016 16:41:01 -0700 (PDT) X-Gm-Message-State: AEkoouu+vHF+RAcjv5WM3rQPZtb/e5xiqIeR2X5nL+esjqpQVlxEh0Ob0IH5ZgIW6QlrELyjUT3fq5lwkmkmkw== X-Received: by 10.31.69.8 with SMTP id s8mr6875653vka.146.1471218060600; Sun, 14 Aug 2016 16:41:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.159.38.70 with HTTP; Sun, 14 Aug 2016 16:40:40 -0700 (PDT) In-Reply-To: References: From: Joy Arulraj Date: Sun, 14 Aug 2016 19:40:40 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: C++ port of Postgres To: kang joni Cc: Dmitry Igrishin , pgsql-general@postgresql.org Content-Type: multipart/alternative; boundary=001a114daf8ae3c7e1053a10a5f5 X-Scanned-By: mimedefang-cmuscs on 128.2.217.202 X-Pg-Spam-Score: -4.8 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org --001a114daf8ae3c7e1053a10a5f5 Content-Type: text/plain; charset=UTF-8 Kang -- Yes, this is one of the reasons why we chose to do this. John -- We have not compiled it with non-GCC compilers. But, I presume that the changes required to support compilation with other compilers should be minimal as we don't rely on any compiler-specific features. On Sun, Aug 14, 2016 at 6:30 PM, kang joni wrote: > I agree with this project, I dont like any setjmp/longjmp and the > like. It just fighting against the nature of c++ language. Building > either from scratch gcc48 or clang381 were easy nowdays on either old > linux debian squeeze or centos 5. PS: I had this requirement > circumtances. > > On 8/15/16, Joy Arulraj wrote: > > Hi Dmitry -- We currently don't use exceptions, but we can certainly use > > them in the port. We can also use STL and smart pointers to simplify > > development and minimize memory bugs. > > > > On Aug 14, 2016 5:41 PM, "Dmitry Igrishin" wrote: > > > >> Hi Joy, > >> > >> 2016-08-15 0:05 GMT+03:00 Joy Arulraj : > >> > Hi folks -- > >> > > >> > We have ported Postgres over to the C++ language (C++11 standard). > >> > > >> > https://github.com/jarulraj/postgresql-cpp > >> > > >> > Our goal is to use certain features of the C++ language and its > >> > standard > >> > library to simplify coding, improve code reuse, and avoid bugs. > Peter's > >> > article titled `Moving to C++` was a source of inspiration for us. > >> What about the exceptions? Are you using them? > >> > >> -- > >> // Dmitry. > >> > > > --001a114daf8ae3c7e1053a10a5f5 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Kang -- Yes, this is one of the reasons why we chose to do= this.

John -- We have not compiled it with non-GCC compilers. But, I presume that the changes required to support comp= ilation with other compilers should be minimal as we don't rely on any = compiler-specific features.
<= br>
On Sun, Aug 14, 2016 at 6:30 PM, kang joni <kangjoni76@gmail.com> wrote:
I agree with this project, I dont like any setjmp/l= ongjmp and the
like. It just fighting against the nature of c++ language. Building
either from scratch gcc48 or clang381 were easy nowdays on either old
linux debian squeeze or centos 5. PS: I had this requirement
circumtances.

On 8/15/16, Joy Arulraj <jarulraj= @cs.cmu.edu> wrote:
> Hi Dmitry -- We currently don't use exceptions, but we can certain= ly use
> them in the port. We can also use STL and smart pointers to simplify > development and minimize memory bugs.
>
> On Aug 14, 2016 5:41 PM, "Dmitry Igrishin" <dmitigr@gmail.com> wrote:
>
>> Hi Joy,
>>
>> 2016-08-15 0:05 GMT+03:00 Joy Arulraj <jarulraj@cs.cmu.edu>:
>> > Hi folks --
>> >
>> > We have ported Postgres over to the C++ language (C++11 stand= ard).
>> >
>> > https://github.com/jarulraj/postgresql-= cpp
>> >
>> > Our goal is to use certain features of the C++ language and i= ts
>> > standard
>> > library to simplify coding, improve code reuse, and avoid bug= s. Peter's
>> > article titled `Moving to C++` was a source of inspiration fo= r us.
>> What about the exceptions? Are you using them?
>>
>> --
>> // Dmitry.
>>
>

--001a114daf8ae3c7e1053a10a5f5-- From adambrusselback@gmail.com Tue Aug 16 04:42:01 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZWCP-0004ca-4L for pgsql-general@arkaria.postgresql.org; Tue, 16 Aug 2016 04:42:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZWCO-0002Qn-MF for pgsql-general@arkaria.postgresql.org; Tue, 16 Aug 2016 04:42:00 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZWA4-0007Y0-PY for pgsql-general@postgresql.org; Tue, 16 Aug 2016 04:39:36 +0000 Received: from mail-oi0-x236.google.com ([2607:f8b0:4003:c06::236]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZWA1-0001Qe-QE for pgsql-general@postgresql.org; Tue, 16 Aug 2016 04:39:35 +0000 Received: by mail-oi0-x236.google.com with SMTP id 4so85286022oih.2 for ; Mon, 15 Aug 2016 21:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=kGBRPhMiLmemcPu599aIkU8QFNmQz/MgpAWpJvzmOn8=; b=QFim+iMTdO/TVhsLqrVIHefYwzJmXXlgU5chKA0bmNN6+bw/JVqTs1EDMzpp27AE2V dHAtx31P27X5p1ZTvQ/sVgFG+f/4K6sL4QjwKbrUuJ6kRLBqG2Rn/JfGK6CxVtYTYHZM qZ543/9IbkZf9dCP4rCIptzKEHH339K2+9uUkTZ1ucosGGDy+fk961UK9gI9gBAKefaL teu669hkSl2fI76Hb/Jw8E6bbF47ZmUSvZBtKoZoRHX4iJFPA9REi7IlZe2GxaeUtsSL jxg8Rh/cWG0V1IpggHHxa/3YfMmsCmom+UrGkiiUyuFYnoUd7BWm+sR3YhxRrqMjopZi pITg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=kGBRPhMiLmemcPu599aIkU8QFNmQz/MgpAWpJvzmOn8=; b=c+NrH7PNJyK/3r8YMNx+I/g34rx204hQFWvkJlVFum7Hjs7bgybberQ8xATjejTmJe 9rE7++Km1E/3NFWtCWWueKKfA5VQKiNzWibkjLDxTvhLG0k6nh47zyoO1XoUwq92hzZi rz8oBuUSXUxJXe0zNNPwTLvPNVht0ftYNlDhYTZz0AYu+aG9xGQcaSHxttTYEFC2fU/S AX4Fx28Brmq9VHIdHxJafMAhU5cZQaFcNIXNeEWhgR4EEST05I9EYi95iluBgEONWeX5 qx9vwCswGFf1YzNdOcWM4yw8NJ+Ct8QKIyOqRuk8IKmJD2JWeIfJpVbxub04mEPEJALE QAbA== X-Gm-Message-State: AEkooutSQryYy9uz5LMM2Y16gO9+rwHco9zg8H0KzX7T56/Nqk6WQGuCuUMCS8wEs175xshB2xvaYZ6xkwYZtw== X-Received: by 10.202.58.9 with SMTP id h9mr1103975oia.19.1471322372938; Mon, 15 Aug 2016 21:39:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.4.84 with HTTP; Mon, 15 Aug 2016 21:39:32 -0700 (PDT) In-Reply-To: References: From: Adam Brusselback Date: Tue, 16 Aug 2016 00:39:32 -0400 Message-ID: Subject: Re: C++ port of Postgres To: Joy Arulraj Cc: kang joni , Dmitry Igrishin , "pgsql-general@postgresql.org" Content-Type: multipart/alternative; boundary=001a113cd1ee63a059053a28ef3b X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org --001a113cd1ee63a059053a28ef3b Content-Type: text/plain; charset=UTF-8 Just wondering what the end goal is for this project... Is it to just maintain an up to date Postgres fork that will compile with a C++ compiler? Is it to get a conversation going for a direction for Postgres itself to move? The former I don't see gaining much traction or doing all that much for the state of the project. The latter possibly could if the community gets on board. Thanks, -Adam --001a113cd1ee63a059053a28ef3b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Just wondering what the end goa= l is for this project... Is it to just maintain an up to date Postgres fork= that will compile with a C++ compiler? Is it to get a conversation going f= or a direction for Postgres itself to move?=C2=A0 The former I don't se= e gaining much traction or doing all that much for the state of the project= . The latter possibly could if the community gets on board.

Thanks,
-Adam
--001a113cd1ee63a059053a28ef3b-- From david@andl.org Tue Aug 16 06:21:26 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZXkc-0000fD-2J for pgsql-general@arkaria.postgresql.org; Tue, 16 Aug 2016 06:21:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZXkb-0002MH-LQ for pgsql-general@arkaria.postgresql.org; Tue, 16 Aug 2016 06:21:25 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZXka-0002MB-RD for pgsql-general@postgresql.org; Tue, 16 Aug 2016 06:21:25 +0000 Received: from sub4.mail.dreamhost.com ([69.163.253.135] helo=homiemail-a106.g.dreamhost.com) by magus.postgresql.org with esmtps (TLS1.1:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZXkW-0005y4-VJ for pgsql-general@postgresql.org; Tue, 16 Aug 2016 06:21:24 +0000 Received: from homiemail-a106.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a106.g.dreamhost.com (Postfix) with ESMTP id 92A602005D00B; Mon, 15 Aug 2016 23:21:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=andl.org; h=from:to:cc :references:in-reply-to:subject:date:message-id:mime-version :content-type; s=andl.org; bh=Vc+3nll46rxdH45THiuTZP1uG+s=; b=Hm 49i+kY7qLUgDcr4w9A0HF5lFxDQzOA66PiY2+39X86MEvn4Z9im9+R0+DxPVCAsT 2XHn7hyirRf4Guob+ci4I1iWlPOXNn0UsBkNpAkh99NsqTio4rcMjfVACQ1sKQ8r Qhnfe18mbKCfXLOm42gkPUVhOBA0AZqntFzcOUujk= Received: from Mona (pow1045804.lnk.telstra.net [120.150.90.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: david@andl.org) by homiemail-a106.g.dreamhost.com (Postfix) with ESMTPSA id 377A72005D00A; Mon, 15 Aug 2016 23:21:15 -0700 (PDT) From: "dandl" To: "'Adam Brusselback'" , "'Joy Arulraj'" Cc: "'kang joni'" , "'Dmitry Igrishin'" , References: In-Reply-To: Subject: Re: C++ port of Postgres Date: Tue, 16 Aug 2016 16:24:27 +1000 Message-ID: <007001d1f786$d903fa90$8b0befb0$@andl.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0071_01D1F7DA.AAB19130" X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQHzYJ7/TjkBpUbQnt1f808SK2P68wIr5sjYAfRvnBIDesSd6ALW2B68ArliDJMCfcjNBgEeXKz7n4INqfA= Content-Language: en-au X-Pg-Spam-Score: -0.6 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org This is a multipart message in MIME format. ------=_NextPart_000_0071_01D1F7DA.AAB19130 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Just wondering what the end goal is for this project... Is it to just = maintain an up to date Postgres fork that will compile with a C++ = compiler? Is it to get a conversation going for a direction for Postgres = itself to move? The former I don't see gaining much traction or doing = all that much for the state of the project. The latter possibly could if = the community gets on board. =20 I would certainly hope the latter. Having done some work on extension = functions and an extension language for Postgres, the current situation = can be quite limiting.=20 * Parts of my code could only be written in C++, so I finished = up with a mixed build, which is not ideal. * My other issue was dealing with the Datum macros. Type-safe = inline C++ functions would help reduce dumb errors. =20 Not compelling reasons perhaps, but just a vote for a move in that = direction, some time. =20 Regards David M Bennett FACS _____ =20 Andl - A New Database Language - andl.org =20 ------=_NextPart_000_0071_01D1F7DA.AAB19130 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Just wondering what the end goal = is for this project... Is it to just maintain an up to date Postgres = fork that will compile with a C++ compiler? Is it to get a conversation = going for a direction for Postgres itself to move?  The former I = don't see gaining much traction or doing all that much for the state of = the project. The latter possibly could if the community gets on = board.

 

I would certainly hope the latter. Having done some work on extension = functions and an extension language for Postgres, the current situation = can be quite limiting.

=C2=B7         = Parts of my code could only be written in C++, so I finished up with a = mixed build, which is not ideal.

=C2=B7         = My other issue was dealing with the Datum macros. Type-safe inline C++ = functions would help reduce dumb errors.

 

Not compelling reasons perhaps, but just a vote for a move in that = direction, some time.

 

Rega= rds

Davi= d M Bennett FACS<= /span>


Andl = - A New Database Language - andl.org

 

------=_NextPart_000_0071_01D1F7DA.AAB19130-- From GavinFlower@archidevsys.co.nz Tue Aug 16 07:55:23 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZZDX-0004Db-MJ for pgsql-general@arkaria.postgresql.org; Tue, 16 Aug 2016 07:55:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZZDW-0007xH-CG for pgsql-general@arkaria.postgresql.org; Tue, 16 Aug 2016 07:55:22 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZZBE-0004yx-AY for pgsql-general@postgresql.org; Tue, 16 Aug 2016 07:53:00 +0000 Received: from mbx.knossos.net.nz ([202.160.48.10]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZZB9-0007qR-4P for pgsql-general@postgresql.org; Tue, 16 Aug 2016 07:52:59 +0000 Received: from [192.168.20.2] (default-rdns.callplus.co.nz [121.99.202.67] (may be forged)) (authenticated bits=0) by mbx.knossos.net.nz (8.14.4/8.14.4) with ESMTP id u7G7qXpi022729 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Tue, 16 Aug 2016 19:52:34 +1200 Subject: Re: C++ port of Postgres To: dandl , "'Adam Brusselback'" , "'Joy Arulraj'" References: <007001d1f786$d903fa90$8b0befb0$@andl.org> Cc: "'kang joni'" , "'Dmitry Igrishin'" , pgsql-general@postgresql.org From: Gavin Flower Organization: ArchiDevSys Message-ID: <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> Date: Tue, 16 Aug 2016 19:52:33 +1200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <007001d1f786$d903fa90$8b0befb0$@andl.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org On 16/08/16 18:24, dandl wrote: > > Just wondering what the end goal is for this project... Is it to just > maintain an up to date Postgres fork that will compile with a C++ > compiler? Is it to get a conversation going for a direction for > Postgres itself to move? The former I don't see gaining much traction > or doing all that much for the state of the project. The latter > possibly could if the community gets on board. > > I would certainly hope the latter. Having done some work on extension > functions and an extension language for Postgres, the current > situation can be quite limiting. > > ·Parts of my code could only be written in C++, so I finished up with > a mixed build, which is not ideal. > > ·My other issue was dealing with the Datum macros. Type-safe inline > C++ functions would help reduce dumb errors. > > Not compelling reasons perhaps, but just a vote for a move in that > direction, some time. > > Regards > > David M Bennett FACS > > / > ------------------------------------------------------------------------ > / > > /Andl - A New Database Language - andl.org/ > I note that gcc itself is now written in C++, and so is squid (web proxy)... In both cases, part of the motivation to change from C was to appeal to new developers - from what I remember of the discussions. Cheers, Gavin -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general From farjad.farid@checknetworks.com Tue Aug 16 11:03:08 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZc9E-0005sB-6G for pgsql-general@arkaria.postgresql.org; Tue, 16 Aug 2016 11:03:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZc9C-0003g9-OR for pgsql-general@arkaria.postgresql.org; Tue, 16 Aug 2016 11:03:06 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZc6u-00015B-0Z for pgsql-general@postgresql.org; Tue, 16 Aug 2016 11:00:44 +0000 Received: from mail1.maytech.net ([46.16.167.130] helo=smtp1.maytech.net) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZc6p-0003PY-Fa for pgsql-general@postgresql.org; Tue, 16 Aug 2016 11:00:42 +0000 Received: from localhost (localhost [127.0.0.1]) by smtp1.maytech.net (Postfix) with ESMTP id 882A421A22; Tue, 16 Aug 2016 11:00:37 +0000 (UTC) Received: from smtp1.maytech.net ([127.0.0.1]) by localhost (email.maytech.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vEI3AClywmUq; Tue, 16 Aug 2016 11:00:37 +0000 (UTC) Received: from DellPC (unknown [95.145.129.67]) by smtp1.maytech.net (Postfix) with ESMTPA id 2896421A1D; Tue, 16 Aug 2016 11:00:37 +0000 (UTC) From: "FarjadFarid\(ChkNet\)" To: "'Joy Arulraj'" , References: In-Reply-To: Subject: Re: C++ port of Postgres Date: Tue, 16 Aug 2016 12:00:34 +0100 Message-ID: <000001d1f7ad$6a3adb20$3eb09160$@checknetworks.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0001_01D1F7B5.CBFF4320" X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQHzYJ7/TjkBpUbQnt1f808SK2P686AIlVGg Content-Language: en-gb X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org This is a multipart message in MIME format. ------=_NextPart_000_0001_01D1F7B5.CBFF4320 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Well done. This is a much needed conversion. As Peter=E2=80=99s article = says, it does open up more opportunities.=20 =20 From: pgsql-general-owner@postgresql.org = [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Joy Arulraj Sent: 14 August 2016 22:06 To: pgsql-general@postgresql.org Subject: [GENERAL] C++ port of Postgres =20 Hi folks --=20 We have ported Postgres over to the C++ language (C++11 standard).=20 https://github.com/jarulraj/postgresql-cpp Our goal is to use certain features of the C++ language and its standard = library to simplify coding, improve code reuse, and avoid bugs. Peter's = article titled `Moving to C++ = ` was a = source of inspiration for us. Regards. ------=_NextPart_000_0001_01D1F7B5.CBFF4320 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

Well done. =C2=A0This is a much needed conversion. As = Peter=E2=80=99s article says, it does open up more opportunities. =

 

From:<= /b> = pgsql-general-owner@postgresql.org = [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Joy = Arulraj
Sent: 14 August 2016 22:06
To: = pgsql-general@postgresql.org
Subject: [GENERAL] C++ port of = Postgres

 

Hi folks --

We = have ported Postgres over to the C++ language (C++11 standard). =

https://github.com/ja= rulraj/postgresql-cpp

Our goal is to use certain features of = the C++ language and its standard library to simplify coding, improve = code reuse, and avoid bugs. Peter's article titled `Mo= ving to C++` was a source of inspiration for = us.

Regards.

<= /html> ------=_NextPart_000_0001_01D1F7B5.CBFF4320-- From Jim.Nasby@BlueTreble.com Tue Aug 16 14:49:28 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZfgF-0008KN-PH for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 14:49:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZfgF-0001Fp-B0 for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 14:49:27 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZfeq-00086V-UL for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 14:48:01 +0000 Received: from mail-cys01nam02on0076.outbound.protection.outlook.com ([104.47.37.76] helo=NAM02-CY1-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtps (TLS1.0:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZfel-0007x6-Jx for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 14:48:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=BlueTreble.onmicrosoft.com; s=selector1-bluetreble-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=tDxSSrRpF3lN5Z3WCNSsnjSlNiLh3uzFJBYas18kY3k=; b=Di4My7cm67D5wO4twavzO/vKXI2S1WXAyvkIYKyS+EaRwpD6fFT5tzjcdoMvbvdNMXtgbPCvCiC+ebeed3eCpBewtzOzxQ7gFXa4WhpvxkywNgIT3PCPEnWoBh/4pVaEVpr3oAmiM7zgObUToRebSaA3zbLOuzW82g32kQgz7G4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jim.Nasby@bluetreble.com; Received: from decina.attlocal.net (2602:306:ce8b:3460:8559:8a:b6a6:5880) by DM5PR11MB1641.namprd11.prod.outlook.com (10.172.38.12) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21; Tue, 16 Aug 2016 14:47:49 +0000 Subject: Re: [GENERAL] C++ port of Postgres To: Gavin Flower , dandl , 'Adam Brusselback' , 'Joy Arulraj' References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> CC: 'kang joni' , 'Dmitry Igrishin' , Pg Hackers , Peter Eisentraut From: Jim Nasby Message-ID: Date: Tue, 16 Aug 2016 09:47:46 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [2602:306:ce8b:3460:8559:8a:b6a6:5880] X-ClientProxiedBy: DM5PR08CA0015.namprd08.prod.outlook.com (10.175.218.25) To DM5PR11MB1641.namprd11.prod.outlook.com (10.172.38.12) X-MS-Office365-Filtering-Correlation-Id: 66e2bdbc-c2e9-42d4-2ba8-08d3c5e44b77 X-Microsoft-Exchange-Diagnostics: 1;DM5PR11MB1641;2:QQVyVHi2CwjCEpTIIGjIhakKgujKpzGJHp1lhf5QSJRECZx39cH79y3+BmeZWhw7eS0Ilb+PTdXH7z8zg0Ax5Zxw3HWeskc6g/Y0Onc6mcGnG66m0aMA8ueCGw3ttTxLOFMDhfZ9GVGo5q6woP8pFBbxaLgUu6KiHPSugQM5U9iVTVFeKU5zy1siOmQlOFhM;3:xeNIFyvQnnxRDbIZgDwSk21zeBOiKnsPw9kBizsQ7+1DtSVxn34ZsCQIYoUFRaGhzM8C/IoB2safF5wZx7kIfhpB8AaFxUQFbJJoMENR8CBaVsqTa2tGTydoPVu1nJ8k;25:ItLznggn9R1oZqXqizvdkcV5nA+9pcRdYzk02MHiYA4JFACHoGNpFTSsxD/B9WPgzS/ai0LaPVAMLNdNPIfSp7lfT04VIXcJafi+2oitPA/JD/DTMrAYNpGwvQy8rhnWfp8bFuj8aIh0/2Ho8QKtCaNH+JXPtwQ0wyI2FZbwKonqwUUlRwlR9jDTyd2ilol840l/cnDv3d7WnO89gvEwUblZe7lEJjOzADaM5iZqAupPKsiDLaFHJqYIR4sPFF9Fvnk2MHt8CtmMwFIi5MSuP5l9d5J9Bmd++S/R4VbNmEM+I9lPDpkOxCbPHhD9oHcOPbEfaTVEDs1PUtBo6izbgsoWnKKw8Kdumc1eSAGDDEdXz7ksbmKAguH3ztrUG5rURAL8lGG16krjSzSddDPERw==;31:phQ0rVA4ZX61sFl6A+PrKTn9HEwn2FuaV3iLMkzaRUViUC2D9pJiYc6FqG7j2/FcEhMzNpTIZxCLQHgPJJ4VP/bSUG8trKu9PfQIxzbRHdo27qW/pWEXscXhmHwG57y3I2WR5YVLejqzsYUHWfQStlpisjAdFB0McMgxTk1RCRMOUVGc86klaFN1xM5MA5RulDtl9YJK4QuXl6GTxunmu42tt7kEvXwgyoGdv8AeKis= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM5PR11MB1641; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101568727142576); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6043046)(6042046);SRVR:DM5PR11MB1641;BCL:0;PCL:0;RULEID:;SRVR:DM5PR11MB1641; X-Microsoft-Exchange-Diagnostics: 1;DM5PR11MB1641;4:4SyQyV5XV861sMgmRlGgxVEp0jL6ur6I08EA5O9GCpzcfURQ4THPhevs1r6JLcLRl2pbEezfaPZHGKkLWCUVtYjcoXVSF4UZ2o1qTendqhSU/pPRkVBO/4BLzgu5safdzU14nCiI36VObUlCs6YbQhUE4DGtau97LDI1HXFK+U0qzfdySa0EekgogtaO40XJGoaWBE1x1+qv/yEUPvFTN1pCOZY/ac5oqMLFrvhiVKc0t1BiP5zqmlhVzkwddl+CKRLVKi8oWLJ8id6SKWLd1i4YgpIAKcqlOH+PNXgt9InN13fhicn8X7yktKvXu8M4cmTb/V1NDiDza68r6hNrnTuDAlBGiWC0yAuW2rTKkOwRJaPZrKxhAOCTxwcAM/uGE8MeJLK4qTpoYRPr5+EAD1O8UrTySR5lxevCtk691Es5QjkgPLKEr+YT4yE2/ZwIb+QpuW+2iIpQujWjsimK2g== X-Forefront-PRVS: 0036736630 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(7916002)(24454002)(189002)(377454003)(199003)(53416004)(42186005)(8676002)(4326007)(65806001)(31686004)(7846002)(50986999)(54356999)(97736004)(305945005)(92566002)(33646002)(7736002)(230700001)(2906002)(16601075003)(65956001)(76176999)(47776003)(5001770100001)(81166006)(4001350100001)(68736007)(81156014)(50466002)(31696002)(19580405001)(101416001)(83506001)(36756003)(2171001)(69596002)(106356001)(93886004)(2950100001)(189998001)(19580395003)(64126003)(15975445007)(105586002)(23676002)(86362001)(575784001)(586003)(6116002)(77096005)(65826006)(3826002)(85282002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR11MB1641;H:decina.attlocal.net;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: bluetreble.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjExTUIxNjQxOzIzOi9wQXc4WFNYQ1h2NXFPSjdieDRpUmI1K0F6?= =?utf-8?B?cFNuTjQya00yc0VaSlNQVjhGVHlldVFUbGt1VUQ4K1ErSjlKb0NwS3U4MjdV?= =?utf-8?B?ZUYvUi9yekRBQW5VMjYrd0NJbTVVN283RUNVa1RvVCtEeEo4cWx5Q09OR2Jh?= =?utf-8?B?WUtrS3VoQjZBNlBWalFPYmhGNHFlRytuWjFUcUN2RHVTVlFqTFZBOTI3YlRy?= =?utf-8?B?MGxXS0VvNkV0cHR3U0RCMjU1TTlnWWxUcTkyc3g2NjlQS1cyTFRSZEN4YVpT?= =?utf-8?B?Zlc3SUNQUHdpWEF2NGxRbTNpajJnZ0hpa0t4c3RneFBHL1ZnMGhhTEYzRHVs?= =?utf-8?B?UlJtc0xnM2lTMkFoMGk2MTNkQTJQNTNsNXFKMnR1OEdBYld5a0IvbndaUEhG?= =?utf-8?B?bkhVSEF2TnN3ZnBIVTBpbGxxT0FOdDRkNHVkWWgyaTQxQmc1aytnbUNSNk12?= =?utf-8?B?Vkd1S2cxZEd0cnZWUkJrazFEL3dwR00rMlA0ZFRFdERYdnhZY3Rid1d1Z0Rz?= =?utf-8?B?N2FuQTJLdXdVMmhKdkVGenlTTjJQVlVWV1ZXcmF2SDM1WjJlbGhoMVcwcGI1?= =?utf-8?B?YnJoSUJsVW1OQzBwY1VEZmdFUllqdVNVOGg2bkZGY1kzUjhNMTVxQmQ3VWdz?= =?utf-8?B?K2pxU2xzakJuV1UwV2VBbjFZWHI3MVBUN0VZVk80VWh5bFhsb3U4d3ZsK3JF?= =?utf-8?B?RUU2ZEo5TE5RVTA1SmtrVDhRcW5OSWgvUnNoSVZ1bnlScUM3Y1VHVnkyYXB1?= =?utf-8?B?aHFyVlBCaUJ2aTh0RzliWjJTT0hPUW5YR1J0cmtHbDFCdk92TXVJcWZLa3Nk?= =?utf-8?B?WTNlVURyclRuc3k4YjZBUTRtWFlFSHZQQXdpaW5LbDlzZnlrTUZBVVY2d1Q1?= =?utf-8?B?aVhSSVgvMWg0dlJIZ1lDNW56YXRnaXNXSFVnWlBRVVAyWlBhZ2xSNXBTbEJH?= =?utf-8?B?YytiTGxQQzRpTzhqMHNSMDd3VDRyMHZ1aU0ybE42bjE2MmlxM0pYbXBrckc3?= =?utf-8?B?T1hJK2lFRlRFaTRUa0UycHBtN1hQeEFkaytrNVBTZTV6L0dlTnRLYlcxV3Iv?= =?utf-8?B?aFNHSWZhMTMwSE1ESGxJZlpGUmU0YnB5RG1xRUdRUGU1akhxNldsTkk1MlVB?= =?utf-8?B?VUF2SmFDY1lpaE1OSHYxcmhXeHVMNllxMnZoamhYWjR1bENDQXg2Qlgrdm9T?= =?utf-8?B?LzJOVHJ2anJzUlVHWDdyV3RNU1k4dDhnZ0lZYmxCSkFuTmJENS9sN3BlM1hn?= =?utf-8?B?QkUyK2RRem1VbnlCaWl1RktyY0xPTkRpSE9xaHRwcXdiUlN4VXVqbGM4NlM3?= =?utf-8?B?bGkybG9lNlMrR3g2cU5ITVdCREYzNnNPSktxNWNKb1I1RG0wWFA4clhUQ1hT?= =?utf-8?B?ZE8vQUpmd3RvSmpWc1VLd2xyL1BjblpOdlNzcThGWGgvWTlFaW9RZnNCcTdC?= =?utf-8?B?RmQ3Z3RYemNqaTJ4ZVlNTjRkRVJoTjZRb0JMcHBiTDZaOEJ6cnUycnJYNmdm?= =?utf-8?B?LzA5MEVEaEtGWTN4dUpYZVV6NGNLZjE3b1dIK0crckpneHhTTTdPUXJqSU9F?= =?utf-8?B?OTRXYXdjWEdpMVNIVlJ3c3MxOW1oYk5jUW5OZWFwMzM5OTFpdktzVm9yRDd5?= =?utf-8?B?ekJIMXlEdkFRa2N4OS9vVVJENURmOU05QVU2MlozUTR6eUMxN3hQbC8vd0hN?= =?utf-8?B?Y09KOHB0Ly9IWmUzU21QMjhCcEU0NnF2NXZpa1J4anV4UEZ1M3hWYUZyOCtD?= =?utf-8?B?bDNPaGlpUmFRRXZXdzN2SnBxZGJwSGs4RlZ6ZzJiNWNXMjhGc2VuVFZHcWtr?= =?utf-8?B?UjNiakI0VTFmaDhFdEV0ZG9UenJ4azZzTi9sTjdRWkdmTlIxU0hHZUxVRXdp?= =?utf-8?B?Wkp4bnk2aW1PcjJHNHd3MXpHUy9Gc1pVTGlNSWJWQXgzRkZPa2ZiSk9IV1BW?= =?utf-8?B?UUNXR2RXeml3PT0=?= X-Microsoft-Exchange-Diagnostics: 1;DM5PR11MB1641;6:ce+H51eZgZyW5vlCqszIg5KB7jpfaSt2fCMftLK0iknDGI59Zg6klCgeZ0d8L2JIDUkKa8wWtLjdJwJOZCzrzcvPx0c3Y8sfL23gvLkzlTlRCu6cdAqWqHAy3ErDjyRskNb7esdBvLy9pV5p6g1RCWhoZhQVWjCOCLEVWKn01/qYnnIOo0Bt171DBCwIdPzFHG8ruvZrP07oTk954Rz4fCHTP7rpk4EiNdDv2/JbObNzEqXrH9aSdtFyzsLauSwWkj6EgwJE+HeJShh8Gz1Lp1rWxrzT/7diqk4tOer1B9KPRvSJ75JATF5+wuZ8sDEA;5:1VAkDnKMGYX1Vg2taFwAwwag74zLp2mgWASMRSUUJND4EsP2W1cq04OHMHHRx8AnSobJVNAFpwg790YD43zzKdgcEADPAL2kj9RnEHRWF2NsU47mKZMnN/8BKW4/Ql921sod4TY8w8PBxHB2i4Ki7g==;24:NpL7tPL78tIAkf/6tJod1ML4Oxv1YP2tJOShHIoui5AaAc8T9HkkBGWLMq/m2K7GtOJxyotK3tSll43Ba+QpHxPiVQ2HvvhR0hYcfKQ56Ks=;7:Q7awg2940XBDuOK7VHMOJ81+c47Z80OgRDvgo+LQrFuYsWSid1RGakonx7YxkMP83/nwHwduG3/6BHH3Z6XEwvXR0mf0dqEC6B6Tn+q5Q7QtTiQtMVmcNxlraLJJ1t/2PyucT2LOaSO9dP1qret9WPRST1ja+f1hMBYa29vyKCy/C4oh/WNZBrH6xkpaswRex7wrCGl2AjEhQ+q/7zHpM8A1RNynK15LPTDtBA0hy7RmxqMQOmAiCEq+qhc2CTMq SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: bluetreble.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2016 14:47:49.3554 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1641 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 8/16/16 2:52 AM, Gavin Flower wrote: > In both cases, part of the motivation to change from C was to appeal to > new developers - from what I remember of the discussions. Moving this to -hackers. Original thread at [1]. tl;dr: A C++ port of Postgres has been created, and several folks on general have commented that this makes it easier to work with the Postgres codebase. This potentially attracts more developers to the project. I hope we can find a way to pull these folks into the fold. People in core have complained that we don't have enough hackers coming in (which I agree with). Part of that is lack of familiarity with C. I think we can all agree that a C++ fork of Postgres would be a huge waste of time, so the question becomes should core postgres start supporting C++. Peter wrote a blog about this in 2013 that makes some good arguments [2]; in particular "easing into" this by first officially supporting C++ compilation. I also like the idea of investigating Rust. I realize there's little technical reason why we *need* C++ support. The level if discipline applied to our codebase negates some of the benefits of C++. But maintaining the discipline takes a lot of time and effort, and makes it more difficult to attract new contributors. My hope is that existing hackers can agree on a reasonable way forward and guide/assist new folks that are interested in walking that path. 1: https://www.postgresql.org/message-id/CABgyVxDBd3EvRdo-Rd6eo8QPEqV8=ShaU2SJfo16wfE0R-hXTA@mail.gmail.com 2: https://petereisentraut.blogspot.com/2013/05/moving-to-c.html -- Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX Experts in Analytics, Data Architecture and PostgreSQL Data in Trouble? Get it in Treble! http://BlueTreble.com 855-TREBLE2 (855-873-2532) mobile: 512-569-9461 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From u.zhuravlev@postgrespro.ru Tue Aug 16 15:24:26 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZgE6-0001MS-SE for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 15:24:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZgE6-0007zS-Ez for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 15:24:26 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZgCb-0005yI-V1 for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 15:22:54 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZgCX-0005ip-Th for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 15:22:52 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 4F30321C2DCA for ; Tue, 16 Aug 2016 18:22:49 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id u0_NJj9jotmO for ; Tue, 16 Aug 2016 18:22:49 +0300 (MSK) Received: from localhost (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id 25F9A21C2DC7 for ; Tue, 16 Aug 2016 18:22:49 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1471360969; bh=EEvZNDe0+WjOBX4B3KW89HPTUCrhXRj2yy4E9CZPHYA=; h=From:To:Subject:Date:In-Reply-To:References; b=fwvHBld5FbhisOr4fKKeZdwIcM/F76RDQA0dXcwHfzU8ReABT7vUeDld0TMNXApNu eByjVipeoIvmqMIe4o8kOgd89R02Ml0chs6q4Qtt7/sip9ewCCtgBanKC/cGkubK6n L8bGbHlIfyfN/zDSYb1ilyc2j5HiVfmbpcLjJ4WI= From: Yury Zhuravlev To: Subject: Re: [GENERAL] C++ port of Postgres Date: Tue, 16 Aug 2016 18:22:17 +0300 MIME-Version: 1.0 Message-ID: <3da0b477-b2cb-42c9-ba75-e0139cd53e7e@postgrespro.ru> In-Reply-To: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> Organization: postgrespro User-Agent: Trojita/v0.6-216-g795fa33; Qt/5.6.1; xcb; Linux; Gentoo Base System release 2.2 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Jim Nasby wrote: > My hope is that existing hackers can agree on a reasonable way=20 > forward and guide/assist new folks that are interested in=20 > walking that path. I tried this path. https://github.com/stalkerg/postgres_cpp=20 And I fully support this desire. But I'm in the minority. >I also like the idea of investigating Rust. I am working on it last few weeks. But it's like seek blocks for new DB. I= =20 don't know how we can insert Rust code into Postgres spaghetti. =20 --=20 Yury Zhuravlev Postgres Professional: http://www.postgrespro.com The Russian Postgres Company --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From a.alekseev@postgrespro.ru Tue Aug 16 15:42:24 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZgVU-0002A7-BT for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 15:42:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZgVT-0005CQ-2s for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 15:42:23 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZgU5-0003gd-OB for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 15:40:57 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZgU1-0000Wm-Nx for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 15:40:57 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 59BB721C2DCB; Tue, 16 Aug 2016 18:40:53 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4srS6YpWv6Ys; Tue, 16 Aug 2016 18:40:53 +0300 (MSK) Received: from e733 (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id 1D1E921C2DC7; Tue, 16 Aug 2016 18:40:53 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1471362053; bh=SPTbo8nio7oFLArkr5BmIgaCMCJ0B3Hg1xrJ4ygnkwU=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=A7U/rbFrWL+v7/tv1s58c7TgO520ifZk0MG6Ux4WzhIkovDwEz/UsC+EBSSFOl7YV RNwDu5Ra38plhVfgL2osBk6SPq9k25OLszy/K5g/wot9l0oks+YW+QixwHo3C23KiH Sil7hdMrnTQKbHOvdj5IpcIh1JNU2F7elXJv6zJY= Date: Tue, 16 Aug 2016 18:39:40 +0300 From: Aleksander Alekseev To: Jim Nasby Cc: Gavin Flower , dandl , 'Adam Brusselback' , 'Joy Arulraj' , 'kang joni' , 'Dmitry Igrishin' , Pg Hackers , Peter Eisentraut Subject: Re: [GENERAL] C++ port of Postgres Message-ID: <20160816183940.4818d854@e733> In-Reply-To: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Well, well, well. Another C vs C++ holly war, really? > > In both cases, part of the motivation to change from C was to > > appeal to new developers - from what I remember of the > > discussions. > > Moving this to -hackers. Original thread at [1]. > > tl;dr: A C++ port of Postgres has been created, and several folks on > general have commented that this makes it easier to work with the > Postgres codebase. This potentially attracts more developers to the > project. I hope we can find a way to pull these folks into the fold. Who are these "folks"? How many more developers it would attract _exactly_, not potentially? > People in core have complained that we don't have enough hackers > coming in (which I agree with). Part of that is lack of familiarity > with C. One again, which "people"? I've seen people complained that there is not enough code reviewers and testers. I doubt very much its something C++ will help with. > I think we can all agree that a C++ fork of Postgres would be a huge > waste of time, so the question becomes should core postgres start > supporting C++. > > Peter wrote a blog about this in 2013 that makes some good arguments > [2]; in particular "easing into" this by first officially supporting > C++ compilation. I also like the idea of investigating Rust. And I wrote a blog post (in Russian) [1] in 2016 why nobody should (if they can) write a new code in C++. In my opinion Rust looks way more promising. However I personally prefer to wait like 5 years before using a new and shiny technology. This is also something I blogged about (in Russian [2], translation [3]). > I realize there's little technical reason why we *need* C++ support. You are right, there is none. > The level if discipline applied to our codebase negates some of the > benefits of C++. But maintaining the discipline takes a lot of time > and effort, and makes it more difficult to attract new contributors. There are companies. They hire developers who write code. Doesn't really matters in which language. Long story short - I strongly believe you are trying to solve a problem that doesn't exist. And probably create a few new ones. [1] http://eax.me/c-vs-cpp/ [2] http://eax.me/cpp-will-never-die/ [3] http://www.viva64.com/en/b/0324/ -- Best regards, Aleksander Alekseev -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From jarulraj@cs.cmu.edu Tue Aug 16 15:46:33 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZgZV-0002MA-N8 for pgsql-general@arkaria.postgresql.org; Tue, 16 Aug 2016 15:46:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZgZV-0000yh-54 for pgsql-general@arkaria.postgresql.org; Tue, 16 Aug 2016 15:46:33 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZgXB-0005Fg-5J for pgsql-general@postgresql.org; Tue, 16 Aug 2016 15:44:09 +0000 Received: from smtp02.srv.cs.cmu.edu ([128.2.217.201]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZgX2-00063N-ON for pgsql-general@postgresql.org; Tue, 16 Aug 2016 15:44:06 +0000 Received-SPF: none (cs.cmu.edu: No applicable sender policy available) receiver=smtp02.srv.cs.cmu.edu; identity=mailfrom; envelope-from="jarulraj@cs.cmu.edu"; helo=mail-ua0-f177.google.com; client-ip=209.85.217.177 Received: from mail-ua0-f177.google.com (mail-ua0-f177.google.com [209.85.217.177]) (authenticated bits=0) by smtp02.srv.cs.cmu.edu (8.13.6/8.13.6) with ESMTP id u7GFhuBb022566 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Tue, 16 Aug 2016 11:43:57 -0400 (EDT) Received: by mail-ua0-f177.google.com with SMTP id 74so128181986uau.0 for ; Tue, 16 Aug 2016 08:43:57 -0700 (PDT) X-Gm-Message-State: AEkooutrHKMZ/JFPnjkkksqEU8iyMu2c442ITs8sCAJ0jQ5DmkUOwucf8HWoZELeHzRHnSLks8/gOjehdSPnIA== X-Received: by 10.159.39.131 with SMTP id b3mr13961785uab.28.1471362236650; Tue, 16 Aug 2016 08:43:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.159.38.70 with HTTP; Tue, 16 Aug 2016 08:43:36 -0700 (PDT) In-Reply-To: <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> From: Joy Arulraj Date: Tue, 16 Aug 2016 11:43:36 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: C++ port of Postgres To: Gavin Flower Cc: dandl , Adam Brusselback , kang joni , Dmitry Igrishin , pgsql-general@postgresql.org Content-Type: multipart/alternative; boundary=94eb2c123c8473a08f053a323714 X-Scanned-By: mimedefang-cmuscs on 128.2.217.201 X-Pg-Spam-Score: -4.8 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org --94eb2c123c8473a08f053a323714 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, Aug 16, 2016 at 3:52 AM, Gavin Flower wrote: > On 16/08/16 18:24, dandl wrote: > >> >> Just wondering what the end goal is for this project... Is it to just >> maintain an up to date Postgres fork that will compile with a C++ compil= er? >> Is it to get a conversation going for a direction for Postgres itself to >> move? The former I don't see gaining much traction or doing all that mu= ch >> for the state of the project. The latter possibly could if the community >> gets on board. >> >> I was kind of hoping that this might start off a coversation on getting postgres to support C++. > I would certainly hope the latter. Having done some work on extension >> functions and an extension language for Postgres, the current situation = can >> be quite limiting. >> >> =C2=B7Parts of my code could only be written in C++, so I finished up wi= th a >> mixed build, which is not ideal. >> >> =C2=B7My other issue was dealing with the Datum macros. Type-safe inline= C++ >> functions would help reduce dumb errors. >> >> Not compelling reasons perhaps, but just a vote for a move in that >> direction, some time. >> >> I concur. > Regards >> >> David M Bennett FACS >> >> / >> ------------------------------------------------------------------------ >> / >> >> /Andl - A New Database Language - andl.org/ >> >> I note that gcc itself is now written in C++, and so is squid (web > proxy)... > > In both cases, part of the motivation to change from C was to appeal to > new developers - from what I remember of the discussions. > > > > Cheers, > Gavin > > --94eb2c123c8473a08f053a323714 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Tue, Aug 16, 2016 at 3:52 AM, Gavin Flower <GavinFlower@archidevsys.co.nz> wrote:
On 16/08/16 18:24, dandl wrote:

Just wondering what the end goal is for this project... Is it to just maint= ain an up to date Postgres fork that will compile with a C++ compiler? Is i= t to get a conversation going for a direction for Postgres itself to move?= =C2=A0 The former I don't see gaining much traction or doing all that m= uch for the state of the project. The latter possibly could if the communit= y gets on board.


I was kind of hopi= ng that this might start off a coversation on getting postgres to support C= ++.
=C2=A0
I would certainly hope the latter. Having done some work on extension funct= ions and an extension language for Postgres, the current situation can be q= uite limiting.

=C2=B7Parts of my code could only be written in C++, so I finished up with = a mixed build, which is not ideal.

=C2=B7My other issue was dealing with the Datum macros. Type-safe inline C+= + functions would help reduce dumb errors.

Not compelling reasons perhaps, but just a vote for a move in that directio= n, some time.


I concur.
= =C2=A0
Regards

David M Bennett FACS

/
-----------------------------------------------------------------= -------
/

/Andl - A New Database Language - andl.org/

I=C2=A0 note that gcc itself is now written in C++, and so is squid (web pr= oxy)...

In both cases, part of the motivation to change from C was to appeal to new= developers - from what I remember of the discussions.



=C2=A0

Cheers,
Gavin


--94eb2c123c8473a08f053a323714-- From jarulraj@cs.cmu.edu Tue Aug 16 15:45:32 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZgYV-0002K7-W9 for pgsql-general@arkaria.postgresql.org; Tue, 16 Aug 2016 15:45:32 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZgYV-0006pu-GY for pgsql-general@arkaria.postgresql.org; Tue, 16 Aug 2016 15:45:31 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZgYU-0006kG-0Q for pgsql-general@postgresql.org; Tue, 16 Aug 2016 15:45:30 +0000 Received: from smtp02.srv.cs.cmu.edu ([128.2.217.201]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZgYQ-00065s-Sd for pgsql-general@postgresql.org; Tue, 16 Aug 2016 15:45:28 +0000 Received-SPF: none (cs.cmu.edu: No applicable sender policy available) receiver=smtp02.srv.cs.cmu.edu; identity=mailfrom; envelope-from="jarulraj@cs.cmu.edu"; helo=mail-ua0-f178.google.com; client-ip=209.85.217.178 Received: from mail-ua0-f178.google.com (mail-ua0-f178.google.com [209.85.217.178]) (authenticated bits=0) by smtp02.srv.cs.cmu.edu (8.13.6/8.13.6) with ESMTP id u7GFjPZK022616 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Tue, 16 Aug 2016 11:45:25 -0400 (EDT) Received: by mail-ua0-f178.google.com with SMTP id n59so128064012uan.2 for ; Tue, 16 Aug 2016 08:45:25 -0700 (PDT) X-Gm-Message-State: AEkoouuZCZsCCLCL/s6nCaXTYF9oEhzBxQHaFrgr15F2Hve2YekzaZjRr8iIgvzy2YqrHzLMTSbfoTH1jX/psQ== X-Received: by 10.176.65.193 with SMTP id 59mr8422356uap.150.1471362324864; Tue, 16 Aug 2016 08:45:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.159.38.70 with HTTP; Tue, 16 Aug 2016 08:45:04 -0700 (PDT) In-Reply-To: <000001d1f7ad$6a3adb20$3eb09160$@checknetworks.com> References: <000001d1f7ad$6a3adb20$3eb09160$@checknetworks.com> From: Joy Arulraj Date: Tue, 16 Aug 2016 11:45:04 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: C++ port of Postgres To: "FarjadFarid(ChkNet)" Cc: pgsql-general@postgresql.org Content-Type: multipart/alternative; boundary=001a114a766cb5ad90053a323cb3 X-Scanned-By: mimedefang-cmuscs on 128.2.217.201 X-Pg-Spam-Score: -4.8 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org --001a114a766cb5ad90053a323cb3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks, I do hope so. On Tue, Aug 16, 2016 at 7:00 AM, FarjadFarid(ChkNet) < farjad.farid@checknetworks.com> wrote: > Well done. This is a much needed conversion. As Peter=E2=80=99s article = says, it > does open up more opportunities. > > > > *From:* pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@ > postgresql.org] *On Behalf Of *Joy Arulraj > *Sent:* 14 August 2016 22:06 > *To:* pgsql-general@postgresql.org > *Subject:* [GENERAL] C++ port of Postgres > > > > Hi folks -- > > We have ported Postgres over to the C++ language (C++11 standard). > > https://github.com/jarulraj/postgresql-cpp > > Our goal is to use certain features of the C++ language and its standard > library to simplify coding, improve code reuse, and avoid bugs. Peter's > article titled `Moving to C++ > ` was a > source of inspiration for us. > > Regards. > --001a114a766cb5ad90053a323cb3 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks, I do hope so.
<= br>
On Tue, Aug 16, 2016 at 7:00 AM, FarjadFarid(= ChkNet) <farjad.farid@checknetworks.com> wrote:=

Well done.=C2=A0 This is a much nee= ded conversion. As Peter=E2=80=99s article says, it does open up more oppor= tunities.

=C2=A0=

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-= owner@postgresql.org] On Behalf Of Joy Arulraj
Sent:<= /b> 14 August 2016 22:06
To: pgsql-general@postgresql.org
Subjec= t: [GENERAL] C++ port of Postgres

=C2=A0

Hi folks --

We h= ave ported Postgres over to the C++ language (C++11 standard).

https:= //github.com/jarulraj/postgresql-cpp

Our goal is to use cer= tain features of the C++ language and its standard library to simplify codi= ng, improve code reuse, and avoid bugs. Peter's article titled `Moving to C++` was a source of inspiration for us.

Regards.

=

--001a114a766cb5ad90053a323cb3-- From hlinnaka@iki.fi Tue Aug 16 15:52:52 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZgfc-0002aZ-HQ for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 15:52:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZgfb-00049H-OZ for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 15:52:51 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZgfa-00048z-Ps for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 15:52:50 +0000 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZgfW-0006FH-Qw for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 15:52:49 +0000 Received: by mail-wm0-x229.google.com with SMTP id i5so177120939wmg.0 for ; Tue, 16 Aug 2016 08:52:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=dEyu9B852gRcdxoanEOp7Rv7sowQVDcGNWYLsLDz4v0=; b=ZEiUBI6BJfgKbEk/eBH4wHt/v2Stjs7LAFW/MVHfKhpMq48fSM0FtUk7EDoYDyuBKk Fi57YVYlXoLNqik+ugJUH3aqyYavMA4mFga9PJxwWU0uQZUKyU1dQyjCTyMMsx/wuRIY YimmogYErE0+oDpCg0tUPJbOByxKsfhAZQWR/VjdHD6sYHAbiw9JGfra4lEQDRY1QQDs BWv6ZFz3Xn0j+HZghtbGXq8/hunhZFv/C5nhuZLGNyt3WvcbLtkmygCx5IxBlYiuxKdN 9ka2xycUAOmJSUlYHBvIL7z2KmHaG7ciOEwiIdAMKmH6K6DY7HXti6UC6fJfiaf+nyDF pV5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=dEyu9B852gRcdxoanEOp7Rv7sowQVDcGNWYLsLDz4v0=; b=UlX5rWkcxZKDTXgTfwXjnmqClUQipz/70HvrUwCBSHfPAUGi78k1xWa/6/PrJvy1PZ 0GXOdJEL1eWmrcp272OcXTutjwFc1+6gK26KlqSW59evPgSJoKXduBaG5Q8KOXYDH9y+ DSACQCHRSrS3DrlHptETm/hToDsjZeexoSMJjJeiWqjsk6MPufk1NuT3Jl/oxgDC16qN LCxgMxUyXjUjWhuF5+3YSf5Xk7sDo9lZPNh00c7HHNw25vAFA1DlTgT7jZjC7WtAEfAM PHxd4oHRWuuRHV+IuvOd6tWoOvx9EnucYlIzqJl51DhVA8WKrDaXjje2KChHqoX8iwmi PR2A== X-Gm-Message-State: AEkoousKJjNF0nDSOhHp+VCGjhYsxX2s18RQJDNa5CIwuLD8saxs6KSkEhrZz2gscZlYCQ== X-Received: by 10.28.50.3 with SMTP id y3mr23259245wmy.23.1471362764353; Tue, 16 Aug 2016 08:52:44 -0700 (PDT) Received: from [192.168.1.111] (dsl-hkibrasgw1-58c38f-82.dhcp.inet.fi. [88.195.143.82]) by smtp.gmail.com with ESMTPSA id b130sm16089145wmg.19.2016.08.16.08.52.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Aug 2016 08:52:43 -0700 (PDT) Subject: Re: [GENERAL] C++ port of Postgres To: Jim Nasby , Gavin Flower , dandl , 'Adam Brusselback' , 'Joy Arulraj' References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> Cc: 'kang joni' , 'Dmitry Igrishin' , Pg Hackers , Peter Eisentraut From: Heikki Linnakangas Message-ID: Date: Tue, 16 Aug 2016 18:52:39 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 08/16/2016 05:47 PM, Jim Nasby wrote: > I realize there's little technical reason why we *need* C++ support. The > level if discipline applied to our codebase negates some of the benefits > of C++. But maintaining the discipline takes a lot of time and effort, > and makes it more difficult to attract new contributors. I suspect that it would take as much discipline to keep a C++ codebase readable, as the current C codebase. If not more. - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From u.zhuravlev@postgrespro.ru Tue Aug 16 16:23:51 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZh9a-0004Cm-Ph for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 16:23:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZh9Z-0002KJ-Kt for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 16:23:49 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZh9Z-0002KD-2B for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 16:23:49 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZh9V-0006jS-HV for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 16:23:47 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 8522E21C2DCB for ; Tue, 16 Aug 2016 19:23:43 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id S983cVeNqazD for ; Tue, 16 Aug 2016 19:23:43 +0300 (MSK) Received: from localhost (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id 5C7E221C2DC7 for ; Tue, 16 Aug 2016 19:23:43 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1471364623; bh=TBpWKdEQSYuNNhaDU8/8uVeutRcc93+4hPxZZTWHbn8=; h=From:To:Subject:Date:In-Reply-To:References; b=PSWgFHP9SN+1yqABoSsFSmfk/Dtx+lCKfhu9ZvBHaIT+PENSxC59dtMKChRqArRbD TvbBsS0xzcbpJMkKlkAf05FKzqQNlJw+YcliU1Qpusw95SVkKYVfj7Ik5d52rl69Xo Ct06/XZOMosHqz3v3pFqJ0R50j53o/UpHLOb6ReY= From: Yury Zhuravlev To: Subject: Re: [GENERAL] C++ port of Postgres Date: Tue, 16 Aug 2016 19:23:11 +0300 MIME-Version: 1.0 Message-ID: <9b5d3b02-d9bb-42d2-9519-c4569f2964eb@postgrespro.ru> In-Reply-To: <20160816183940.4818d854@e733> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <20160816183940.4818d854@e733> Organization: postgrespro User-Agent: Trojita/v0.6-216-g795fa33; Qt/5.6.1; xcb; Linux; Gentoo Base System release 2.2 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Aleksander Alekseev wrote: > You are right, there is none. First: trees in parser, planer and etc.=20 Second: normal exception. Two big projects lately move to C++ from C: GCC, Mesa You can read their reasons. Only C++ we can use without full rewrite currently. (or ObjectC maybe) If we wish fix C limitations.=20 --=20 Yury Zhuravlev Postgres Professional: http://www.postgrespro.com The Russian Postgres Company --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From robertmhaas@gmail.com Tue Aug 16 16:35:15 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZhKc-0004wx-OD for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 16:35:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZhKc-0007xX-9k for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 16:35:14 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZhJE-0006OP-VK for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 16:33:49 +0000 Received: from mail-qt0-x230.google.com ([2607:f8b0:400d:c0d::230]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZhJ7-0006tU-HQ for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 16:33:47 +0000 Received: by mail-qt0-x230.google.com with SMTP id 52so37665317qtq.3 for ; Tue, 16 Aug 2016 09:33:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Syt2Dq+X64Vk/R/FMPlMZ/Iw1yquoSP+nyOTddfgoxA=; b=P9V7yALbcu9HJJi11HOu1l7/RCOTRcet6bolv2Q3DyF/JPvQVedYnSHhS5CeMf+dE1 l94dLPmg0HmXM8GC+4JZNNYxpYp17krJa+Qk+wk8/ao94NDA/OBShj9uON2ShjslZe6i UjyH+pDAR+rV09c6sdHcSk/+J4cIIDGOuWsSlptNCTtXWWZboBuFTWCP2RtPgxxUWJSL gpy4Et0Iaqi6eSgH9WCgxumPqARK8PiwLcN/XOEmVWAPWsVXdCcrpO2ZdsBXMJlqeOHS ZodqgOoPwEnLsVdXd1hskh7hxnbHjOqJzLv4vR3zjI8gpBjDFZG5Ktv9TPCx2/fxwj+J VtzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Syt2Dq+X64Vk/R/FMPlMZ/Iw1yquoSP+nyOTddfgoxA=; b=HHTar2sFmgwEp3HuuyelWRTAw71Nb4dl+JuncasGv5XqWLswIGD8L5MGiCV5W3anvA PzkG14y/HvHQUfZggNJuTuBKUrjAoToDRC1zCErUpwYFptRuRaZ6nCwF6+4n2IzNbw4D OlH91BtsNAn54YefiU0ctjfMDYwCTg8QBfxEYGRav+pVXuAJ+Dir25T+StIhurC4vuWu c9ZnllFvs8r2yLRnTDwD962NvD5KZs1Vze3u2iNkgMLG4kXbtqnyuZJYHv+xTePCaX32 XvApYz4ttss1WxK9EfRT2VAMCAmyap9uCB/D+Z1zYVPeHAUzgbv0r3IVWZo5V7kgbl4r 1PFg== X-Gm-Message-State: AEkoouueIXx6X/bAWXqt7Rc+mdKHf2s31Pw3g+TUfJuZ+wQL6SFY6Pxsbo6lQfshsBjF/ttkXvp71ODe5FwHKg== X-Received: by 10.237.52.101 with SMTP id w92mr40107893qtd.51.1471365220534; Tue, 16 Aug 2016 09:33:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.49.75 with HTTP; Tue, 16 Aug 2016 09:33:40 -0700 (PDT) In-Reply-To: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> From: Robert Haas Date: Tue, 16 Aug 2016 12:33:40 -0400 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Jim Nasby Cc: Gavin Flower , dandl , Adam Brusselback , Joy Arulraj , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Tue, Aug 16, 2016 at 10:47 AM, Jim Nasby wrote: > On 8/16/16 2:52 AM, Gavin Flower wrote: >> In both cases, part of the motivation to change from C was to appeal to >> new developers - from what I remember of the discussions. > > Moving this to -hackers. Original thread at [1]. > > tl;dr: A C++ port of Postgres has been created, and several folks on general > have commented that this makes it easier to work with the Postgres codebase. > This potentially attracts more developers to the project. I hope we can find > a way to pull these folks into the fold. > > People in core have complained that we don't have enough hackers coming in > (which I agree with). Part of that is lack of familiarity with C. > > I think we can all agree that a C++ fork of Postgres would be a huge waste > of time, so the question becomes should core postgres start supporting C++. > > Peter wrote a blog about this in 2013 that makes some good arguments [2]; in > particular "easing into" this by first officially supporting C++ > compilation. I also like the idea of investigating Rust. I'm not really interested in supporting PostgreSQL code written in other languages entirely, such as Rust, but I do think it would make sense to write our code so that it can be compiled using either a C compiler or a C++ compiler. Even if we don't ever use any C++ code in core, this would let people who create forks or extensions use it if they wished. It wouldn't be that much work to maintain, either: we'd just set up some buildfarm members that compiled using C++ and when they turned red, we'd go fix it. I agree with your statement that one of our biggest problems is getting more developers interested in working on PostgreSQL. Even if there's only a 10% chance that something like this will help, why not? We're not talking about moving the earth. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From jd@commandprompt.com Tue Aug 16 16:58:09 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZhgn-0006Z3-5G for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 16:58:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZhgm-000708-3V for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 16:58:08 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZhgk-0006zG-GW for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 16:58:06 +0000 Received: from lists.commandprompt.com ([2604:da00:2:2:5054:ff:fe07:7618]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZhgc-0007Kw-FV for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 16:58:04 +0000 Received: from [192.168.1.60] (spinlock.commandprompt.com [69.168.55.30]) by lists.commandprompt.com (Postfix) with ESMTPA id B78F417C; Tue, 16 Aug 2016 09:57:45 -0700 (PDT) Received: from c-73-225-27-179.hsd1.wa.comcast.net ([73.225.27.179] helo=[192.168.1.60]) by assp.commandprompt.com with SMTPSA(TLSv1_2 ECDHE-RSA-AES128-GCM-SHA256) (2.5.1); 16 Aug 2016 09:57:41 -0700 Subject: Re: [GENERAL] C++ port of Postgres To: Robert Haas , Jim Nasby References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> Cc: Gavin Flower , dandl , Adam Brusselback , Joy Arulraj , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut From: "Joshua D. Drake" Organization: Command Prompt, Inc. Message-ID: Date: Tue, 16 Aug 2016 09:57:39 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Assp-Version: 2.5.1(16177) on assp.commandprompt.com X-Assp-ID: assp.commandprompt.com m1-66665-03630 X-Assp-Session: 7F0CB4671908 (mail 1) X-Assp-Original-Subject: Re: [HACKERS] [GENERAL] C++ port of Postgres X-Assp-Client-SSL: yes X-Pg-Spam-Score: -2.4 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 08/16/2016 09:33 AM, Robert Haas wrote: > On Tue, Aug 16, 2016 at 10:47 AM, Jim Nasby wrote: >> On 8/16/16 2:52 AM, Gavin Flower wrote: > I agree with your statement that one of our biggest problems is > getting more developers interested in working on PostgreSQL. Even if > there's only a 10% chance that something like this will help, why not? > We're not talking about moving the earth. Right. It is just reality that less people are learning C which means less people will be interested in joining a project that is focused or (required) to be C. Sincerely, JD -- Command Prompt, Inc. http://the.postgres.company/ +1-503-667-4564 PostgreSQL Centered full stack support, consulting and development. Everyone appreciates your honesty, until you are honest with them. Unless otherwise stated, opinions are my own. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From tgl@sss.pgh.pa.us Tue Aug 16 17:00:18 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZhis-0006iZ-Gt for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 17:00:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZhis-0001bv-3b for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 17:00:18 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZhiq-0001Xv-Oa for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 17:00:16 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZhin-0007Lu-Vt for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 17:00:15 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u7GGxOvZ027272; Tue, 16 Aug 2016 12:59:24 -0400 From: Tom Lane To: Robert Haas cc: Jim Nasby , Gavin Flower , dandl , Adam Brusselback , Joy Arulraj , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut Subject: Re: [GENERAL] C++ port of Postgres In-reply-to: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> Comments: In-reply-to Robert Haas message dated "Tue, 16 Aug 2016 12:33:40 -0400" Date: Tue, 16 Aug 2016 12:59:24 -0400 Message-ID: <27271.1471366764@sss.pgh.pa.us> X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Robert Haas writes: > I'm not really interested in supporting PostgreSQL code written in > other languages entirely, such as Rust, but I do think it would make > sense to write our code so that it can be compiled using either a C > compiler or a C++ compiler. Even if we don't ever use any C++ code in > core, this would let people who create forks or extensions use it if > they wished. It wouldn't be that much work to maintain, either: we'd > just set up some buildfarm members that compiled using C++ and when > they turned red, we'd go fix it. I think this might have advantages purely from the standpoint of new compilers possibly offering useful warnings we don't get now. But if we only go this far, I'm pretty dubious that it really helps people to develop extensions in C++. Almost invariably, if you ask *why* they want to do that, you'll get an answer involving C++ libraries that are not going to play very nice with our error handling or memory management conventions. I do not see how we could C++-ify the error handling without making a complete break with C compilers ... which is a step I don't really want to take. The whole thing would make a lot more sense given a credible design for error handling that keeps both languages happy. A lot of the other things people have muttered about, such as heavier use of inline functions instead of macros, don't particularly need C++ at all. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From robertmhaas@gmail.com Tue Aug 16 17:13:14 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZhvO-0007Zu-9j for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 17:13:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZhvN-0007wR-R4 for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 17:13:13 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZhvN-0007w6-3j for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 17:13:13 +0000 Received: from mail-qk0-x230.google.com ([2607:f8b0:400d:c09::230]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZhvI-00026B-US for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 17:13:12 +0000 Received: by mail-qk0-x230.google.com with SMTP id v123so77308740qkh.2 for ; Tue, 16 Aug 2016 10:13:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=e5iTT53V3KYdknA0gTS3/Xwp/NHRwG8acZqFSU/T2FE=; b=nq+G4ePjd6iTGPGJmA988sNw56r9AQsIab8119u5Nf6a40MOOA0yq0oLALZvxVhWt4 n81GGQCs6AafLDJZyI6SX4u4d2oon70EEQzBGgpuU+esfngDTH5P/2S5CdOdLIVO0Rso 5Ln7OMDg6Phlmz62JsaWV5mWQMY5sRyupUgGli3y5oi8sv31+lIRpmU8tTxRgcBGB6uY lEmzjgUDsVvSbymQuc5EeBt1Iz3Pd9Y32ziR+2ytvqR4L13NU8xjAri6IJFUYn9NqvLg ngYlXdmL+KjniToeiDKee4OxvCLT5VSCphb3UY6eN1QoiLejaYZ7IxrT5vS/b/FUrOUt BfAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=e5iTT53V3KYdknA0gTS3/Xwp/NHRwG8acZqFSU/T2FE=; b=c0v0WgfR6VgnULhGblOm9Ulr4NPh5gw5x4uFwlMWaWZsN2P7PMWJuWSbi3zkE83OY8 maQSLOdfNmWIcigi+q0bc61qDsPryH7V6b/zTHL82T1f1HxA4f7FT2Pk9Rlfo5GkWGbu K39957wk+QQMK5ZYA07HrL4bRwaW6EIYdkZ30Ek1t5MIt+SxvBAYVWXMGGzaZ1JKCtyZ TuTUSzXJMGTGMR5D6x0M7/pps5Quethd9K8jBxeIChDV/K/2AjGhTsoH4A7cZcIOAOg7 zjCBb8rB9trFQ1PNyr39xeI+eIe+imNPkCEy0dAtRb4dR6vwypJbzGSeD9PTluQ8odAn 9G3Q== X-Gm-Message-State: AEkoouuWEKn2z6v+c5sWjSEQSIVpW5Fgct2eo3AaIS9UBcfoN6w2CPBlOwLu8i1cJ+ZhFwX1JaHb1cQfHlJTKQ== X-Received: by 10.55.126.195 with SMTP id z186mr35332166qkc.76.1471367587066; Tue, 16 Aug 2016 10:13:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.49.75 with HTTP; Tue, 16 Aug 2016 10:13:06 -0700 (PDT) In-Reply-To: <27271.1471366764@sss.pgh.pa.us> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> From: Robert Haas Date: Tue, 16 Aug 2016 13:13:06 -0400 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Tom Lane Cc: Jim Nasby , Gavin Flower , dandl , Adam Brusselback , Joy Arulraj , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Tue, Aug 16, 2016 at 12:59 PM, Tom Lane wrote: > Robert Haas writes: >> I'm not really interested in supporting PostgreSQL code written in >> other languages entirely, such as Rust, but I do think it would make >> sense to write our code so that it can be compiled using either a C >> compiler or a C++ compiler. Even if we don't ever use any C++ code in >> core, this would let people who create forks or extensions use it if >> they wished. It wouldn't be that much work to maintain, either: we'd >> just set up some buildfarm members that compiled using C++ and when >> they turned red, we'd go fix it. > > I think this might have advantages purely from the standpoint of new > compilers possibly offering useful warnings we don't get now. Yeah, that could be nice. > But > if we only go this far, I'm pretty dubious that it really helps people > to develop extensions in C++. Almost invariably, if you ask *why* they > want to do that, you'll get an answer involving C++ libraries that are > not going to play very nice with our error handling or memory management > conventions. I do not see how we could C++-ify the error handling without > making a complete break with C compilers ... which is a step I don't > really want to take. I agree, but we don't have to agree to change everything before we agree to change anything. If we got an agreement to try to make everything compile in both languages, that'd be more agreement than we've ever had before, and I'd rather take that agreement and run than look a gift horse in the mouth. > The whole thing would make a lot more sense given a credible design > for error handling that keeps both languages happy. Well, getting so that we can at least compile in both systems would certainly increase the chances of somebody being willing to work on such a design. And if nobody ever does, then at least people who want to fork and do research projects based on PostgreSQL will have slightly less work to do when they want to hack it up. PostgreSQL seems to be a very popular starting point for research work, but a paper I read recently complained about the antiquity of our code base. I prefer to call that backward-compatibility, but at some point people stop thinking of you as backward-compatible and instead think of you as simply backward. > A lot of the other things people have muttered about, such as heavier > use of inline functions instead of macros, don't particularly need C++ > at all. True. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From jarulraj@cs.cmu.edu Tue Aug 16 17:54:21 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZiZB-0001Ot-HF for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 17:54:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZiZA-000406-9b for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 17:54:20 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZiZ9-0003zr-JX for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 17:54:19 +0000 Received: from smtp02.srv.cs.cmu.edu ([128.2.217.201]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZiYz-0002og-EO for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 17:54:17 +0000 Received-SPF: none (cs.cmu.edu: No applicable sender policy available) receiver=smtp02.srv.cs.cmu.edu; identity=mailfrom; envelope-from="jarulraj@cs.cmu.edu"; helo=mail-ua0-f181.google.com; client-ip=209.85.217.181 Received: from mail-ua0-f181.google.com (mail-ua0-f181.google.com [209.85.217.181]) (authenticated bits=0) by smtp02.srv.cs.cmu.edu (8.13.6/8.13.6) with ESMTP id u7GHs426028864 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Tue, 16 Aug 2016 13:54:05 -0400 (EDT) Received: by mail-ua0-f181.google.com with SMTP id k90so134164629uak.1 for ; Tue, 16 Aug 2016 10:54:04 -0700 (PDT) X-Gm-Message-State: AEkooutkTDqZzfUo8KrgnTVf1kh5NN9XAE1WUqb9xt1ebsBrKa42Ne3/wS6CS7Y3ZrR5atSPKS3UjHoKdFVT3g== X-Received: by 10.176.3.183 with SMTP id 52mr13124392uau.29.1471370044291; Tue, 16 Aug 2016 10:54:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.159.38.70 with HTTP; Tue, 16 Aug 2016 10:53:43 -0700 (PDT) In-Reply-To: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> From: Joy Arulraj Date: Tue, 16 Aug 2016 13:53:43 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Robert Haas Cc: Tom Lane , Jim Nasby , Gavin Flower , dandl , Adam Brusselback , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut Content-Type: multipart/alternative; boundary=94eb2c066f3ad2c8ec053a3408d1 X-Scanned-By: mimedefang-cmuscs on 128.2.217.201 X-Pg-Spam-Score: -4.8 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --94eb2c066f3ad2c8ec053a3408d1 Content-Type: text/plain; charset=UTF-8 On Tue, Aug 16, 2016 at 1:13 PM, Robert Haas wrote: > On Tue, Aug 16, 2016 at 12:59 PM, Tom Lane wrote: > > Robert Haas writes: > >> I'm not really interested in supporting PostgreSQL code written in > >> other languages entirely, such as Rust, but I do think it would make > >> sense to write our code so that it can be compiled using either a C > >> compiler or a C++ compiler. Even if we don't ever use any C++ code in > >> core, this would let people who create forks or extensions use it if > >> they wished. It wouldn't be that much work to maintain, either: we'd > >> just set up some buildfarm members that compiled using C++ and when > >> they turned red, we'd go fix it. > > > > I think this might have advantages purely from the standpoint of new > > compilers possibly offering useful warnings we don't get now. > > Yeah, that could be nice. > > > But > > if we only go this far, I'm pretty dubious that it really helps people > > to develop extensions in C++. Almost invariably, if you ask *why* they > > want to do that, you'll get an answer involving C++ libraries that are > > not going to play very nice with our error handling or memory management > > conventions. I do not see how we could C++-ify the error handling > without > > making a complete break with C compilers ... which is a step I don't > > really want to take. > > I agree, but we don't have to agree to change everything before we > agree to change anything. If we got an agreement to try to make > everything compile in both languages, that'd be more agreement than > we've ever had before, and I'd rather take that agreement and run than > look a gift horse in the mouth. > > > The whole thing would make a lot more sense given a credible design > > for error handling that keeps both languages happy. > > Well, getting so that we can at least compile in both systems would > certainly increase the chances of somebody being willing to work on > such a design. And if nobody ever does, then at least people who want > to fork and do research projects based on PostgreSQL will have > slightly less work to do when they want to hack it up. PostgreSQL > seems to be a very popular starting point for research work, but a > paper I read recently complained about the antiquity of our code base. > I prefer to call that backward-compatibility, but at some point people > stop thinking of you as backward-compatible and instead think of you > as simply backward. > > I agree, this was the main reason why we wanted to add support for C++. > > A lot of the other things people have muttered about, such as heavier > > use of inline functions instead of macros, don't particularly need C++ > > at all. > > True. > > -- > Robert Haas > EnterpriseDB: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > --94eb2c066f3ad2c8ec053a3408d1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Tue, Aug 16, 2016 at 1:13 PM, Robert Haas <robertm= haas@gmail.com> wrote:
On Tue, Aug 16, 2016 at 12:59 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@g= mail.com> writes:
>> I'm not really interested in supporting PostgreSQL code writte= n in
>> other languages entirely, such as Rust, but I do think it would ma= ke
>> sense to write our code so that it can be compiled using either a = C
>> compiler or a C++ compiler.=C2=A0 Even if we don't ever use an= y C++ code in
>> core, this would let people who create forks or extensions use it = if
>> they wished.=C2=A0 It wouldn't be that much work to maintain, = either: we'd
>> just set up some buildfarm members that compiled using C++ and whe= n
>> they turned red, we'd go fix it.
>
> I think this might have advantages purely from the standpoint of new > compilers possibly offering useful warnings we don't get now.

Yeah, that could be nice.

> But
> if we only go this far, I'm pretty dubious that it really helps pe= ople
> to develop extensions in C++.=C2=A0 Almost invariably, if you ask *why= * they
> want to do that, you'll get an answer involving C++ libraries that= are
> not going to play very nice with our error handling or memory manageme= nt
> conventions.=C2=A0 I do not see how we could C++-ify the error handlin= g without
> making a complete break with C compilers ... which is a step I don'= ;t
> really want to take.

I agree, but we don't have to agree to change everything before = we
agree to change anything.=C2=A0 If we got an agreement to try to make
everything compile in both languages, that'd be more agreement than
we've ever had before, and I'd rather take that agreement and run t= han
look a gift horse in the mouth.

> The whole thing would make a lot more sense given a credible design > for error handling that keeps both languages happy.

Well, getting so that we can at least compile in both systems would<= br> certainly increase the chances of somebody being willing to work on
such a design.=C2=A0 And if nobody ever does, then at least people who want=
to fork and do research projects based on PostgreSQL will have
slightly less work to do when they want to hack it up.=C2=A0 PostgreSQL
seems to be a very popular starting point for research work, but a
paper I read recently complained about the antiquity of our code base.
I prefer to call that backward-compatibility, but at some point people
stop thinking of you as backward-compatible and instead think of you
as simply backward.


I agree, this was the mai= n reason why we wanted to add support for C++.
=C2=A0
> A lot of the other things people have muttered about, such as heavier<= br> > use of inline functions instead of macros, don't particularly need= C++
> at all.

True.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--94eb2c066f3ad2c8ec053a3408d1-- From dmitigr@gmail.com Tue Aug 16 19:42:42 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZkG2-0006Ui-Bj for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 19:42:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZkG1-0000TS-Pv for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 19:42:41 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZkG1-0000TL-0l for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 19:42:41 +0000 Received: from mail-it0-x22c.google.com ([2607:f8b0:4001:c0b::22c]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZkFx-0005Mx-Fw for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 19:42:40 +0000 Received: by mail-it0-x22c.google.com with SMTP id f6so76485279ith.0 for ; Tue, 16 Aug 2016 12:42:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=9wGmNQF8wXDwFhVl3HWGXHQp/AI14cqj82s7q52sPq8=; b=O4PwofabzzRE//rxLIrEJTWshgp6KrfC/ecwmITm3KagxkZPTLa2W67J95zKGxdQ5l B4SNafX6tg65XHqyaLnxAlCvNhbYhQ19uF4cm+lX1aUGvkfjPVx7TdvhgRZr7wozBJAU JQLKqqZK+jjoQO3MpkD92TZizpOgjobynDLh2jK5s1fQfEqu9TKW9sP8mpQ0wAQ85NbD hWQzuadZXFZfPVnVbCcIEc+lzng1bYdZRx2FVM1ZcOwS2Y2ENl8qCrD7OssYfqXtNmOM M+xP4PFrxSdaQiNn+unwFdo52ACVCTcp9+fAsHrWTzgpQP81ar4IxAgLcb+2ERtgUn+S aXGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=9wGmNQF8wXDwFhVl3HWGXHQp/AI14cqj82s7q52sPq8=; b=Evf/8m44tHIhRfTyvYf42e8g4jRLf8Rw1e6cwgFm+JiiKn/HL8ipqAbA7hQRbA8JQG 4O1zSqdtk62gybUmp4bibNh69aNWacplooKFMB1CUs6f0bzA3z3F+Tqsj6Tc3udvRDkR p04hZVrmx+Ed9vFRJE3ogE6aCuS8mAHqwcYItBuAy+GqblvpYWzD5sHsEjHyrm4L3klX 9yBj3OhPUfks9Un/SdcjQ6hM95hT9rSJYtJY8vNwnL9jNVp609s+Oolt1dAANKGOcIed FGUg4J6z/ABb6B3JlEIa2u+MjDS5mpA/G/73dD0E1N4gYmAgpLAv+XHQo/FGQpWQtN55 q3/g== X-Gm-Message-State: AEkoousNnI6hoZZCn4RlFLcXvPs/4/LiZpsmp0aloqMg1i6jYO6yv3zSZKGpEHgTnzQAsdk5lxpv1vw9ZoVaSw== X-Received: by 10.36.152.5 with SMTP id n5mr22568940itd.79.1471376555345; Tue, 16 Aug 2016 12:42:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.38.70 with HTTP; Tue, 16 Aug 2016 12:42:34 -0700 (PDT) In-Reply-To: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> From: Dmitry Igrishin Date: Tue, 16 Aug 2016 22:42:34 +0300 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Heikki Linnakangas Cc: Jim Nasby , Gavin Flower , dandl , Adam Brusselback , Joy Arulraj , kang joni , Pg Hackers , Peter Eisentraut Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 2016-08-16 18:52 GMT+03:00 Heikki Linnakangas : > On 08/16/2016 05:47 PM, Jim Nasby wrote: >> >> I realize there's little technical reason why we *need* C++ support. The >> level if discipline applied to our codebase negates some of the benefits >> of C++. But maintaining the discipline takes a lot of time and effort, >> and makes it more difficult to attract new contributors. > > > I suspect that it would take as much discipline to keep a C++ codebase > readable, as the current C codebase. If not more. For example, its easier and less error prone to define structures with virtual functions in C++ than write vtables manually in C. So, the adequate subset of the C++ features can be useful to write more readable and maintainable C-style code. These features are: - abstract classes (well, structures with virtual functions); - RTTI; - lambda functions; - constexpr functions; - destructors; - templates (very reservedly). But these features should be avoided (as least for now): - exceptions; - the parts of the standard library which generates exceptions (in particular, regex and thread). -- // Dmitry. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From Jim.Nasby@BlueTreble.com Tue Aug 16 20:07:44 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZkeG-0007Z1-HK for pgsql-general@arkaria.postgresql.org; Tue, 16 Aug 2016 20:07:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZkeG-0008GJ-3l for pgsql-general@arkaria.postgresql.org; Tue, 16 Aug 2016 20:07:44 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZkbl-0004At-UL for pgsql-general@postgresql.org; Tue, 16 Aug 2016 20:05:10 +0000 Received: from mail-by2nam03on0055.outbound.protection.outlook.com ([104.47.42.55] helo=NAM03-BY2-obe.outbound.protection.outlook.com) by makus.postgresql.org with esmtps (TLS1.0:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZkbi-0002oT-6M for pgsql-general@postgresql.org; Tue, 16 Aug 2016 20:05:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=BlueTreble.onmicrosoft.com; s=selector1-bluetreble-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Xe7himQvSNK1x4EIc4UlrwlCzHyk7llUJG4P64tYZZY=; b=Idln1mhilry+z/vOyuTtnJnkPE88eAD9THl3syhS6kkN2fYlspxF+qHFlERNlDIlEvVc72Mc5UoxOihEUDg6JiWajR4OXcpKVjd9h40xXR3gBPoI5O/YSHoUN57jrfCjQMtu/xTPm0KLT3vOIDBbZnlvMpfP3tgZp4sI3Yzm1vc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jim.Nasby@bluetreble.com; Received: from decina.local (70.113.16.71) by CY4PR11MB1637.namprd11.prod.outlook.com (10.172.71.13) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21; Tue, 16 Aug 2016 20:04:55 +0000 Subject: Re: C++ port of Postgres To: Gavin Flower , dandl , 'Adam Brusselback' , 'Joy Arulraj' References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> CC: 'kang joni' , 'Dmitry Igrishin' , From: Jim Nasby Message-ID: <90e98f78-b091-c2cd-a1ba-e6c0c2471e51@BlueTreble.com> Date: Tue, 16 Aug 2016 15:04:37 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [70.113.16.71] X-ClientProxiedBy: BLUPR0301CA0019.namprd03.prod.outlook.com (10.162.113.157) To CY4PR11MB1637.namprd11.prod.outlook.com (10.172.71.13) X-MS-Office365-Filtering-Correlation-Id: a1d5e1b4-aa94-4eaf-ec87-08d3c6109c5d X-Microsoft-Exchange-Diagnostics: 1;CY4PR11MB1637;2:RWiEfjl+i7mv3Tq2gQ3im9KlqNtbHZvzn5UMVFn4PKIm+dduvN3gr/Ja97uDQaylDBxOCFNDTWI8Cb1whgqxukFI+KvcOhEJ1a6GrlYhI7AtWPIDZ+/lMWhmihl80mTjcpjt2ap/BTqmrI1wHhZTbSUHRlcwu1rg9xQxyuh8w2qPLDViX0hQaD4e45OgpeVz;3:lnAM0SuO7/AGEOVnh6qroPbmiFbaz1CpVYvxdPs3AhHbFt10nQ9aYmW45EdePIpidWn7pcilfis4cPIvGnqQNuyaJ6URqvHcTm30YWV4UmDeLSPbarw5yLX+V9S8dyDT;25:Z7ZF0XTNx6Jly3ARbmXl0U39ZMI8BdoVaFyVSf9aKJIPF294lqUvJVlxRAaIj1SQNCrcksw3/AKnVhRQW/THBkt9B1KYG9rVXGF7j80fNxJefXZ6ZnaXbx27aL7xkWgjLdFyyU9U5fdTIPP7QlNKLvmqidsZAVE6W7dd61NnQwcsbYAJOg/v4t/aQU9Foz4qLju51Llc5+yNLnpx8bFpldt5FDSGvmcooZOnVGCOxsypBMaBuV4eFv3X/4UFr14xAtbg1lju3GNp1IQPfKGznvDqZy5HTnCv+h/TsFAs4scgSoHInVqE7oUz/w3cOABfNEZ4MKx7KfeaeepsVXdrstJGgPm/3xzev0dkf4E/YXGEMFXACj2T3KHAncG7PwD79vfkaYb1CNJy6QrPxuSf0ssEq8Xx5zdLngQdrrrQePk= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY4PR11MB1637; X-Microsoft-Exchange-Diagnostics: 1;CY4PR11MB1637;31:zeoMU3cVWoa12NQ0pj74aeSnsBZ5uuG9wNk8d+2ROA6iwvPyQglJ7v7EhiTuoHNymYaeNlwSeEBhnye/jOjVGUgD7YoUlVHhwVStPnubWBeco4mQcKVKndHR4bROcpew9JWZLAzeBeP5vuWTcCP0RsxswhjIA8p9BWOSes3numS2vTjzpey3fqaoFKTGMakOBR/BSHzm3ESJRrDHtGRv+05kYDTbFn58vyCGYEtOX28=;4:wJ61xCQk+ZtVCpIBoU1/G3ug4UOK2O9NwneHt88fCWatBy41cAfuLaAA7bsljNpTgWjoMq+DtAuBxNxz2gl8rn/o8K7tEE1jAy1ra5UPBBSbyIPc1GD2uycJEiN8REa3ATIq0F3/grScoPSFSk5yjTsc1a1RmJctKBtmFt9FMD0ydVNk7OOoWFzX9v1S59P7WW5saQyq3LW8VqpoNyIw7kFGzCDWaAhykK/IBlBSO0roGcRwjoGBrH8Jy23wlbmgcpQjf/OUXm1eJ1DL4jeE64z6ba56pggIsa171DJWir+Kuqdt52p7zh9p4ayqBKwkLC14AHUU0GeB4sWpF7wv/OySj38iihLGMwbfVV04jwhTg+7ZtzMVJwNFDi0jKp+28iDcPtBhMDoyv5F2Z+y13b9sW5kVU/UHDeNHNG80JvhDp1ED4QhnrctKGTdMsjp5uwqjwNPWogmcJQbHAxNWbg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(101568727142576); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6042046)(6043046);SRVR:CY4PR11MB1637;BCL:0;PCL:0;RULEID:;SRVR:CY4PR11MB1637; X-Forefront-PRVS: 0036736630 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(7916002)(24454002)(377454003)(199003)(189002)(586003)(92566002)(33646002)(7736002)(7846002)(305945005)(93886004)(19580395003)(66066001)(64126003)(81166006)(76176999)(8676002)(65806001)(81156014)(47776003)(16601075003)(65956001)(50466002)(42186005)(31686004)(50986999)(105586002)(106356001)(575784001)(4326007)(54356999)(5001770100001)(101416001)(2906002)(6116002)(36756003)(97736004)(23676002)(77096005)(86362001)(230700001)(19580405001)(4001350100001)(68736007)(83506001)(31696002)(189998001)(3846002)(2171001)(15975445007)(2950100001)(65826006)(85282002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR11MB1637;H:decina.local;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: bluetreble.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjExTUIxNjM3OzIzOnFMUGNyWFNadmQ5M3kzQzhwQzZkdmdXM2ZM?= =?utf-8?B?bUtGVTg2MWRiVnNJQW4wSm44aHFDdTZLeW82bWZYenpyVXJDSkhzRy9aYkVx?= =?utf-8?B?TXVjVVZSczQzVXFhcjlmWlZGaFpENnQ4bzdOeFZtaExJc3NrWktiT3ZQTjJv?= =?utf-8?B?NlNjQnB4SVZnNG5jZTM2TmpPVjJPbmUxUkQ4QVRHT2k3RFBNeWlEM2hzd2Nw?= =?utf-8?B?THhNVmpzRFNncE1sRDZuZE10d1JEbHNvUUlRMU9ScnVuL3E5dkhnZy9idWwv?= =?utf-8?B?WlVaYjlKM1grSnFSaS9iZXMydnpzbXJNMjVpV2d2ZjhxazRBWHJqS2FnZE1o?= =?utf-8?B?djFhYzI4a3UzY3VSZ0d6VDBoZTluWWREWVBtUURsTC9iTE9IOXV6TkZLY0xi?= =?utf-8?B?WHNPYjJMQmpyb0h3TWJSck1BYzFGWXBqTU5pWHYyWUJiOElWcFZpeGxQME02?= =?utf-8?B?ZWtHNXdEREwwNDc2YzhJZnNQQXZDdXJGR25nbm4wMmtlVjVpUUkrenJtWXRQ?= =?utf-8?B?MVRIUU9YVkg2QWl5MUFqcDlPV21VZVFLbjg3YmN3bWFNYW15SHBwVDJBc3pK?= =?utf-8?B?N2IxV0o2eUVJa2tiUktIcmdMak4rN21VYm4xbGovSGxZMGU5Q3h0MmkyRVo4?= =?utf-8?B?Y3hDM1IzY3ArTUFBejF1NFFWbkRFQlhpUnI0QktIblNaUDQxWU9nQkRuT1hy?= =?utf-8?B?VkxGYUJiWXBXT2tZYXgrYXc1VEJ0Z2h3MWIxaGxGeE5BV2NHSVBqU3BGZ01k?= =?utf-8?B?RnR3eVkvZy9SL1c3Zi9TTkRZeWZYcXVyRGVyTklFaXpKTm9DNmVZTGhYVmFN?= =?utf-8?B?amg1bGVnTEFZQUtXMGhkZ09taGMrdXVkcVFaSmFtQTJYckppdnZpNDgvQVBM?= =?utf-8?B?ZHBWbm9FOGxQWUNRQWtjS0I4cFU1U1BZRmVRaXFlbWw2enExV3Y5SGtRR2V0?= =?utf-8?B?YVpqVktKTGZEcFIyWkJ6YmZFcnd3cnI4eS9WaTNISjc5NVNlbTEyWFpUaFF3?= =?utf-8?B?c2tETDdINVhDOUlacXF3VVFFTE0xQ0hSRHo2ZHY5VnRBRWt3RlFSV2xYTTRH?= =?utf-8?B?V0k0cU12NXdjcWhkR0VVWlpBbmR4SnZLWGNQdjlqT0xOWnYyV3Fmc2wyWkpl?= =?utf-8?B?MkRQUS9pSkV3OHNnRHorVHF6UWs4bG5aVXY2ZVdIMkhrOE5SZkhGZVZtMHhl?= =?utf-8?B?cDRwSGZwRkI5b1FXTFhvc2Vta09vYnJHMXh3M0VLYmd0TVZ2NVp4KzRwa0l3?= =?utf-8?B?dXY0TXNmWEIrTkswcUdoY3VoZ3ZoTmNYM3NDcTM5UVB1ZjlXYlhzSm5jcE0y?= =?utf-8?B?R0RyZ1h1KzdCUW03U0RWN05aeTNIdEMrVzNpTW9Oc29lWHRuSUgwMHNzWnZ0?= =?utf-8?B?QXFXMGxZbDFIUVA5OVVwMGpYdE9icTdJSnR2ZHFzdFlBVW1qYisvRDhVRk5D?= =?utf-8?B?OTA2UDEzdGx1YWF3WTFVZ3cwM3hTcDdmTGhWYmZMTWYwQmtvNUREWWZRekpR?= =?utf-8?B?U0U2c1lJUndKcHdZajFadDVjQ28rNEE4VVk5cEZiVVMvckprYjhMVmdUcDhT?= =?utf-8?B?K2g5Q1pZRjhQdlZncnVaWFJKTWRwSU40M2l1bnBLeHo2NU05Z21WQ0ZoQUYz?= =?utf-8?B?cCtpZlBaakZzcnNwZndEdnFpYmIzYjVsdzZxR25nc1dwa1MxS0IrM3J1MVA0?= =?utf-8?B?L2k3cHQxeGViZThJZXRrVHNmR0hwNUZRY2xoZEcyRTllMmIvUnRvd0NSdC96?= =?utf-8?B?dXdNNnJ4cWpnOVlSN2ZEOTAvUy90MHdHTEdmYi9neDd0QmdvVFFkWmtIUFd4?= =?utf-8?B?YmdZODJ1MjVDdlk1R0orZXlCMHhrVE1hMHFrajk5WCtqVDY4ajMxQ2NZTzF1?= =?utf-8?Q?grgBOYvohyMOg6p2aC2tnh9zvs1wQVPH?= X-Microsoft-Exchange-Diagnostics: 1;CY4PR11MB1637;6:bb1YKvlBhlItBkezrXorrTMVpVrjXj0TtdOic71UFz2VWLAPTX3tPpkD/V6VkEke3ki926oq/a/nd594tT/QkxMTx8c8a0cNIFS084N1cuXUwGdsP1eCtIEkoiWur0+2gtBvW6LMdbWVBRpWECRleYc3egf89gRVMBYJQ7lS5hpWnPgtQdtUNDgcsOnIIpY11RW2BZHZT35WA/aZ2d/nujT3AWvWEuEjcRimTQDoproDCQXp/KSL9zJygtfn4N7mX0VPVfCMryTf9cS18bAPVKQYJNM5EfEE+jpT2OxyT2IFWcmV7b9PKwdHmZf6mFOf;5:i8qschfdrfY1DD5kAefXMR1dtyKZ/A42eVP8y84ff2ekc8jrcw775NA9LSHVY+x1zoEo0qKdo5swNb70eyzsVIEMmdhvSnOMzQYOGQNFNxxhkwc87uPkPVwa0WwqD/U20IXLpYnnj3/Kz0TqAio5Sg==;24:T1NzmhUtKSA9HEiFnWj7kci3kMewXTKZ0sRHy9bcO6ErcL9czitieu0KoY3E61oX0W7C1O/M+mxPY0Y6tOcGkeOpERpC3m77WucaoIBdkBg=;7:tFYwSgRBb8PRRazDqUjCO1/BZ7Wnv+lpw+x6x5fG28GYI4sf3sZCRFTY4KPe/2FQspSJvXwqIwfYQAlLJTzZt9uNBPrbO0v20k1CKOdOO49lf4hjXxUwJEu29zYdm9M1dPjd2utVeTAYir2QwH/FK+zJjzY7UhVZve5QVI7oTdXWvdUtSuh8mQlIPGfF1eXK+4iFPFCIozM3sjvcZo5pl9VzJIcAJQp3yQl+fwXeyTrR/9pF9tsUazC8ingZBs1/ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: bluetreble.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2016 20:04:55.3641 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1637 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org On 8/16/16 2:52 AM, Gavin Flower wrote: > In both cases, part of the motivation to change from C was to appeal to > new developers - from what I remember of the discussions. I have moved this discussion over to -hackers. (https://www.postgresql.org/message-id/f7682c24-4271-1ff5-d963-053ecb0fce40@BlueTreble.com) -- Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX Experts in Analytics, Data Architecture and PostgreSQL Data in Trouble? Get it in Treble! http://BlueTreble.com 855-TREBLE2 (855-873-2532) mobile: 512-569-9461 -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general From Jim.Nasby@BlueTreble.com Tue Aug 16 20:22:43 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZksl-0008Fp-Ie for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 20:22:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZksk-0003Fu-Ei for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 20:22:42 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZksj-0003Fn-OH for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 20:22:41 +0000 Received: from mail-cys01nam02on0085.outbound.protection.outlook.com ([104.47.37.85] helo=NAM02-CY1-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtps (TLS1.0:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZksa-0006Ie-2v for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 20:22:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=BlueTreble.onmicrosoft.com; s=selector1-bluetreble-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=l0PnB+Pj/erBzvtpd1GU/BtBQeY71UDF3knZvIcwbes=; b=e/OQyudtB9Kxi/bsc8OkohbP5X8q2EWl0gjW7cSS5iOhigyQazlMttQ1fexQyVcwNzPcrrpWgvXt750JUSqdKJ1fok+xjg6Tjx8D5IpFIKTCu8VTe0PJHbct2k7BZopbzqIogAVQINyWseAYvsaLQJ4mgA1QuJWUdcIHYcnwoTs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jim.Nasby@bluetreble.com; Received: from decina.local (70.113.16.71) by CY4PR11MB1638.namprd11.prod.outlook.com (10.172.71.14) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21; Tue, 16 Aug 2016 20:22:18 +0000 Subject: Re: [GENERAL] C++ port of Postgres To: Joy Arulraj , Robert Haas References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> CC: Tom Lane , Gavin Flower , dandl , Adam Brusselback , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut From: Jim Nasby Message-ID: <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> Date: Tue, 16 Aug 2016 15:22:09 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [70.113.16.71] X-ClientProxiedBy: SN1PR17CA0041.namprd17.prod.outlook.com (10.169.33.179) To CY4PR11MB1638.namprd11.prod.outlook.com (10.172.71.14) X-MS-Office365-Filtering-Correlation-Id: 858ec60b-9d96-43d2-7d2a-08d3c6130a67 X-Microsoft-Exchange-Diagnostics: 1;CY4PR11MB1638;2:dTR3PJKTOQYg9/xmXJVTds583AVBMSlN0C0OmaPWXJ5jmQYkSHbCr4FVHLOTzf0daEQ7aNYzxWnFFTSG8FvS/hzJbgphfLYTn7SSsEIQWxOQBOO8xTXoKo9g463dJhLdUIa/Nb0xzswcPxHNX92HqkFpW3JpmtY8ad41CIfAfKsDRdl0By/hWdRApVoKJxqh;3:lrQxGJGtx7XN2BiMsMaI6+xSqKXMhOY3bIGedGlzx6pOLkxvU1dhivsXCQU8nbTyY7XnFF2IXAS4XDLr2l0z5SlYvg1uJteFV6cWgig3H17HvKEHHWsQG6NuQWi/X1sH X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY4PR11MB1638; X-Microsoft-Exchange-Diagnostics: 1;CY4PR11MB1638;25:sXLxcB8ZK26vFRJr0CoFmq/HGrNs03mpK+aCmktB1Hv96FtFZDktUONOI2cM2sDSSwNPkIRUh/FBjdeYd+2NE/dGjCUzmP7KIl/ZHkuy6CGbSxf0dPewNMHplbfMbKULwWeWx1IY9uVd8WVtBHXhtuyEkK/NBp6oXDddpHnFOguAheISU4N116pM2/A7Rly+5FLiM6MiqDIABsV8ekA0xJztHckG19C3PUoF3TB/G9bAuxHCufuy9Ie4QLdeaZtBFxbFF2ddcHdlkXHGQY9lPSyiEwVAqJkwA+G9EyHD6LGidjFqBGuS+oiv4eYJ2y0kdU2smw7YMu+n16TbCfKBHo6SC/G7QXbE3lYnHsaA3CMBxTbj80Q7x0sjBtWLhJT3g1mIpOB4W9l2tigxcLGj+OHCSLHEQKkv47V6CvNn+e+NWPcmEA6exROr8FL9e1VSIISIU0fuzpDFImsICQeXBumqecl79r92LaI5YNScvgiRoaef/bp7ByocPMLhHT1GkuLB4BO/EjRKX2SqpUqS3wlCF5MQMyKfgN0oCepct6h2H5BqLvvPmTQ4vHT2QnpjMrgSal15hysvsyYw10GUvlWDe5lM0otv5Wh03DbSh8a9bBBPE795dC5t126Ff9p0JFvb0m11E9F9eq43TsRhEAXkxN6q8t6RU20iPAMWkhkGjdSFrqgQIJg+o38cAtqvKD/o4UrMWeVj+I1LnP4z+A0hYfvg2PjSGf6ewqu6tdyhDWJA1tveKYJbnRY6NlJFOS7drkXTx2fxDKByj7L8KSxJYoOdr12Qm5DOokz8cVip9KSZhIyxnqs9kevjsk2h X-Microsoft-Exchange-Diagnostics: 1;CY4PR11MB1638;31:znKdR5zXTP+B1MQHDDVo3m0yuA0Ejf5in9/mZhGoozlIu2S8Wa39RJ5jVAzyBzdWpMImQE4G5dKYPK/uP3bGbsi8hB9+Jt3y9f7F6KWEY2TvX2QUbCVnjq9DLbgxrIzGxUWdwrRFdvFQfsf1BZp2j3i2HNAZnEjvwfzi6xYr9PezY6uh9zeDYmEW7HsH+hKLhAlqrAzmXSSb6VUKVfrllsIP8taWl/2yABd+iacNVgA=;4:9T/XgKrqtlZg5BqN+sbsDYfu40cKzjHwowrxvRriySFtxNH/dXQLitky9TZiSusb+Lq48pr33YuyhlVLDid2WJvnvlf22RCAG6oWX5LtohfaR8qM4uJCnGaIOLCHH0/UPjQLtizFQ7sOL1EgmePoZ0PebgeVP9mmoyhIxArX9WZKQXRsAcUfMrgLWCRrUHVbE+IlcFdKsZhcfHi62W+f09faXUP2XC+4WaXwG3rOaMJA+IctPyJwYKfZqR/NVbF3n35RX4tZ6Sz5VdjcnZB19dH6EGusKLzTV3SiVrDuwoD3xvR7eXuh1eVxSNZSTgG4ZVBA+T7pI4jSTERlGbsnYQqXwn57mMBf36qMQYQft6wBDzaZjNCxD3yUfbDySpJ4Vl99LYIrV9KesMmkaIS8A83HCqVn82sqG51XtIsMi/87IZM8PFLnLewVIcm1xgC56/4impRlfzDkpM7UmJVEUw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(5213294742642); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6042046)(6043046);SRVR:CY4PR11MB1638;BCL:0;PCL:0;RULEID:;SRVR:CY4PR11MB1638; X-Forefront-PRVS: 0036736630 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(7916002)(199003)(24454002)(189002)(377454003)(42186005)(50466002)(47776003)(31686004)(16601075003)(105586002)(83506001)(106356001)(64126003)(36756003)(76176999)(54356999)(2171001)(86362001)(50986999)(101416001)(93886004)(31696002)(586003)(66066001)(65956001)(65806001)(5001770100001)(4326007)(19580395003)(189998001)(2906002)(6116002)(7416002)(7736002)(3846002)(305945005)(230700001)(2950100001)(23676002)(77096005)(68736007)(81166006)(8676002)(33646002)(92566002)(7846002)(4001350100001)(97736004)(81156014)(15975445007)(65826006)(85282002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR11MB1638;H:decina.local;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: bluetreble.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjExTUIxNjM4OzIzOlFFNXJYRko4U3BBODgza0xxd2l3cjdSUkNh?= =?utf-8?B?NExDUC9oVFZIK1J6UElPTTA4dVVHbjJtOGY3bmowNWhDaWNGT2sxZ2dnOW5s?= =?utf-8?B?KzE3NGx2UmtadUlDSjlvWUhLRDczWjY3Wmw5N21tcDJxREluYzFOdElHaTdo?= =?utf-8?B?MW9VQU5OZWNOckpYZ3BXdEg1K053OFFrczBPZTFxY2diWUlrNm9jQWZBTEg3?= =?utf-8?B?bDF4ZEtWL3Jva1l4WTdoMnZsYTZaMEtJZ2I2ZE9PQ1c5Mmo2aFVRSjQ0WUJW?= =?utf-8?B?SmgwcEZpWkQ0anhmb2ZrK2dCWkF5eEdYNFppVE5rTHlaOUNZcWtTTitzS254?= =?utf-8?B?NVhVOWVwa2tJR1BJVDBqSUJDeFlPcFg2cGNYc29lVGlISFdibkIyaFVEMnFp?= =?utf-8?B?N2MxT1BsWGUzWlBmNk1rVmIvd24vcWdKQ0crcmZNNElBczBDMmdGU2lYblpC?= =?utf-8?B?MUE3aGxpL3lJRGwxVFNKSGNXSEtXSTk5cHNhM1hhYitXTVVzd1NXaEpOSkZ2?= =?utf-8?B?RXR3YTYvdUhLRTVrREN5TE9jVGNNdG5FWnNmTmdnang5YWovZWZrZDRWcnJO?= =?utf-8?B?Q3pHV0tmemZ2azFpNVNCQ1FlOXZsMlJSTFVtK1VVaktLdFJ2NkFNd0NuUG1F?= =?utf-8?B?SFJsNU9KbWI2V2tIajBGL3FLNDliMmpOejVEZ1Uwbks1NmY5STNscUJaN2dE?= =?utf-8?B?TTl4UG40aitSQWJtWU1ONGxuUTc5K0owUzhxSkM3VzZLM3ZHeU5oa3o3ZUZH?= =?utf-8?B?aHVKRHNCNmdwRHhVOHVLK2xBM0U2RVRpUEFqdkFvRVJyMm9hd2oyVGNvMlpL?= =?utf-8?B?UjNJUEllN1BvZ2FLQlV1a2dFZW1XRnlIZkgwTVRjNURSMnJLYWtJUEZyay93?= =?utf-8?B?Myt1SFF4UVhrRkJoRGIvcWgwQU1WWGF4YXVPNTRhNUJYZDZ2RXp1bXhRVVFX?= =?utf-8?B?S1AxcjNKUHFlU0hGVk94bDI3WHJaL0RuR2piVG9zQlQxRmZZTU8xeGt1anBs?= =?utf-8?B?aUhjUjgwcDl1VUovK1ltWGR4eUp5WnVQWVJLbWZPRWthdGN0K1lIaUltK3Js?= =?utf-8?B?bFJ6ekdFL2U5U1FDTFY2QXhocmpSdTJLdy9JVW1yQlc3Q1FkTC82SG8wbXVJ?= =?utf-8?B?eEUzUWtiSW5hVVllek4wYjZqeEhIVlZhTERmTzFjZVlVdVF1Wm5vSkVVcTEv?= =?utf-8?B?Q0hBeFlPa1dYZWZjU01tT0d4QXRBaHY4anFINVJYaWpJekozdkNKZk9MYzVC?= =?utf-8?B?djllMGlmajdyWVFNMitEcldINFpQR3R6Y3lITzZCUnRuOStaOHB0Zmh5U3Yr?= =?utf-8?B?V0JMc1NTamk1SG9aSW53L2R2N01lR1ZQaFhNMTNMQXQ3aEttMVFyK0gwMXZG?= =?utf-8?B?Ylp4ZTVFQnVoNTZwTDdzK0doc0c5dnZ3elY0QnUxamQwTEk4am5oYmE1R3VQ?= =?utf-8?B?VEVHTmFaeWc5NEh5Z1ZhNjVwd0VQMis0dm5GQzdtYk1XLzZ1R2lFdDZod1NG?= =?utf-8?B?eVV0MUR5bGozOHBOSml5dFFFUmwxS3JucG9sdjdmdzU0UEtKMHA4dTBaRTNT?= =?utf-8?B?NDZTbVJKa0VHVE9Qd3BCQ0c5NjZzUXZXdXpOQmZWbzJKVjRpLzhVOU8vYUls?= =?utf-8?B?YTFVK0RZTmFOQ2ZMVTdrOGdEcDhkaTcwWVJVWnA4RlZtbjFyQndrSHZKT3Y0?= =?utf-8?B?VFJTbm1hV1lBbCtZK1I3dU1MajQ3THNNakMzUU1FTkJkeUpYdW13NllLazdP?= =?utf-8?B?SmRsN045MjUyUExDTkc1SDhkSHlLMnFPNE4rbERlVkx2ekwzNFRUdWdERmk4?= =?utf-8?B?RFlQdlpKbWxOUE15MFE1MEc3WTRFbkVmNXJ5WHRCM2ZGQ0E9PQ==?= X-Microsoft-Exchange-Diagnostics: 1;CY4PR11MB1638;6:H5DjxDR6tG6toK1z/FcvUqfNOhaBYnOlQ5UgRHSZB1vLJ0+9q9KfUjTpx79EqYNCXvT0WLt1AlhltmKdJxLuB/OIUwlaLjn959+dbsB+AErhrOviKyXMqn7OLWUwX6szSPQVVYAApd2pNi1pUSes5sGbF6xkKN1PJ1/GM6wf294gYNHCj+SNwqa942THREJKmce5bDvOyP8zeVana5GqlAWhs945Xm453ZkD1G64Fv3xiz9P5wJH4QXOWyg5bJyEpIZ1dNBdtiN0Pr7fmkBZLw8DB7hZFbEifkIA5O7biQ9qmsNnZX8LZtg8YEkimA77;5:e30U7LHfHmR8KEE+7lHXXviMRzfm6knDpQSl5c8zTkSGlu7a9sf2rKOu/5litGAYwO4HCMHFu5njqOKJj/o6Zk/GzpZtBbcIPv+ZBvELNny+Uh0l7kbmvD4BgGE9UKDLla4uszKhXTBc1StWDqbgxA==;24:6mjLQuK2OpaU2wyeUi3debHgu3gTtOcU0lNeOV/sa555e8vnLfH95V2wFZL0aR2lpkKCLoiKd40B8Il7b+Inru5et6C4239beOPqmyyiSuA=;7:9+FpnVKuK0CWArq05GuOhkYyTh1JTCszBG7ULJr9DErlC/R83KsxuvggFsMJdYsNf9mDuk7VAu4IqN8ca3ah9qw5IeBGiyjGRvCiv9PqD5iW1mZUQcPUSBNC5iDDs5Ly5H85AHby40zl5h25ZXV3djxVbILtqhnjz2TMfds2q3rV8VArdjl2RECRkJrCEjhIi6YCiWkJ3vp4/oLJ61UlQFrP7Drm+vDp5Lqcs/n8/DKix5fGSB7JwP2IN2ZzbRaA SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: bluetreble.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2016 20:22:18.8355 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1638 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 8/16/16 12:53 PM, Joy Arulraj wrote: > > The whole thing would make a lot more sense given a credible design > > for error handling that keeps both languages happy. > > Well, getting so that we can at least compile in both systems would > certainly increase the chances of somebody being willing to work on > such a design. And if nobody ever does, then at least people who want > to fork and do research projects based on PostgreSQL will have > slightly less work to do when they want to hack it up. PostgreSQL > seems to be a very popular starting point for research work, but a > paper I read recently complained about the antiquity of our code base. > I prefer to call that backward-compatibility, but at some point people > stop thinking of you as backward-compatible and instead think of you > as simply backward. > > I agree, this was the main reason why we wanted to add support for C++. Joy, do you have an idea what a *minimally invasive* patch for C++ support would look like? That's certainly the first step here. -- Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX Experts in Analytics, Data Architecture and PostgreSQL Data in Trouble? Get it in Treble! http://BlueTreble.com 855-TREBLE2 (855-873-2532) mobile: 512-569-9461 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From andres@anarazel.de Tue Aug 16 20:31:01 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZl0m-0000GG-V0 for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 20:31:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZl0m-0000tC-Hi for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 20:31:00 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZkzO-0005Jc-CO for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 20:29:34 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZkzL-0003K1-Mn for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 20:29:33 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id CFD9A20461; Tue, 16 Aug 2016 16:29:30 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Tue, 16 Aug 2016 16:29:31 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=sB73aY9UNY+u6Yf1+td/tBBU770=; b=EsqCq cuGQVAigpOLa13xMzkZzppNqYfeC0wPONQfWEDCO34N/nq6gHzoskIu0U5/qCV6/ 8RrFWLgvyaWglQo0RF123jnLuScJat1FmwD0W8mdK/y1v7ExmX2j4OGSiBlM/lRF /gzLtly0aS9DQhQBDu9YbkKSlC0gtYVJ55rOg4= X-Sasl-enc: GMXqbh2uTku/BLB0NtSXc3yX0ubvPDfSxPC4ZrxlgpKu 1471379370 Received: from intern.anarazel.de (somacentral1.static.monkeybrains.net [162.217.75.74]) by mail.messagingengine.com (Postfix) with ESMTPA id 5D2DEF2986; Tue, 16 Aug 2016 16:29:30 -0400 (EDT) Date: Tue, 16 Aug 2016 13:29:29 -0700 From: Andres Freund To: Heikki Linnakangas Cc: Jim Nasby , Gavin Flower , dandl , 'Adam Brusselback' , 'Joy Arulraj' , 'kang joni' , 'Dmitry Igrishin' , Pg Hackers , Peter Eisentraut Subject: Re: [GENERAL] C++ port of Postgres Message-ID: <20160816202928.v62426ta2w4yauk7@alap3.anarazel.de> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2016-08-16 18:52:39 +0300, Heikki Linnakangas wrote: > On 08/16/2016 05:47 PM, Jim Nasby wrote: > > I realize there's little technical reason why we *need* C++ support. The > > level if discipline applied to our codebase negates some of the benefits > > of C++. But maintaining the discipline takes a lot of time and effort, > > and makes it more difficult to attract new contributors. > > I suspect that it would take as much > discipline to keep a C++ codebase > readable, as the current C codebase. If > not more. Well, having typed pg_list.h style lists, ilist.h linked lists, hash-tables, and proper typechecks for pg_nodes.h instead of the NodeTag stuff, would surely make life easier. But given the small subset of C++ available on all our supported platforms... I think we'd first need to make the decision to cut support for some platforms, before using C++. Which imo is a distinct task from *allowing* to compile with a C++ compiler. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From pg@heroku.com Tue Aug 16 20:29:52 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZkzg-00006O-Ek for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 20:29:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZkzg-0005wZ-1b for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 20:29:52 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZkze-0005rd-Ok for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 20:29:51 +0000 Received: from mail-ua0-x22a.google.com ([2607:f8b0:400c:c08::22a]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZkzb-0003KE-Qn for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 20:29:49 +0000 Received: by mail-ua0-x22a.google.com with SMTP id n59so140996025uan.2 for ; Tue, 16 Aug 2016 13:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heroku.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=yXsvm8TVY3yYa4Rsd7PM4kCYCZLDkmxK5Js8mCFkDpg=; b=sfALjxtQNymVuBkgoL1HEsZI5Q+7I3ZDo4hCRQWSloH5bZfINVhKPUmah7WOuRrk5/ K3kpdXhQOHEoQHqOfeZrguyOdxNeBTtgOq1jATaJGcyOst4EMhiHEtdCsVdpUr+w2pf0 9a0iX8+5MfKPuu3vX2oG5QSu/9EpWrJ6TiQ3GRSoOes8qh8O8/y2aBXYuMnlF232Ujx3 nZmzHMfGukojIlBLD2UJtK+aph9qNKBCA+l4SxhqcYG9MS5Gtylaj+EpJ0nH5DeY58R2 aJF1VyL72RMZGRnLWbdr6xIv92TwPZX8E86OUlSoFcVLiHOOzUfqGv9RnHfIAKBk9g09 vqPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=yXsvm8TVY3yYa4Rsd7PM4kCYCZLDkmxK5Js8mCFkDpg=; b=ifD8sAw6zP2d5pA6D0Vmr6AvZXlG680I15HSND3AVZ9rP/0MThuwDgDI4ontyTSI1N 32cbR7uOSce3sANE7kSW6ZdxufNFxQ+7hLLFpJnbiSpVk9Vuua1toUYBzu3YCplWo7og fbEMEBnXKkt/jTxJ33FMT2aAI2n3Wv4HATigUjJiGZHh8mBwzOoQCBvbCR4wtOnvLs9a mh2HbTfjSD8lu5TCps2cZeA9kj5jcwi95kGIYXYyKNK9/c7eEknNaj88mk7ocIpc/KbK +USsPvk4SQsHMOitWK9KE7uHJaFzvRwmOUf7y8bKUjP53NXm572iC2oBvM36rst+0GEV hxIA== X-Gm-Message-State: AEkoouvZvw6nqqD13zEAP27LwmUxgu+6HcnwJytie8JQszh2uRHWPMPA19UId6IGhBW/YPueDUb/2pm1KrI3S3wK X-Received: by 10.31.9.67 with SMTP id 64mr17435540vkj.89.1471379386365; Tue, 16 Aug 2016 13:29:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.53.195 with HTTP; Tue, 16 Aug 2016 13:29:45 -0700 (PDT) In-Reply-To: <27271.1471366764@sss.pgh.pa.us> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> From: Peter Geoghegan Date: Tue, 16 Aug 2016 13:29:45 -0700 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Tom Lane Cc: Robert Haas , Jim Nasby , Gavin Flower , dandl , Adam Brusselback , Joy Arulraj , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Tue, Aug 16, 2016 at 9:59 AM, Tom Lane wrote: > I think this might have advantages purely from the standpoint of new > compilers possibly offering useful warnings we don't get now. But > if we only go this far, I'm pretty dubious that it really helps people > to develop extensions in C++. Almost invariably, if you ask *why* they > want to do that, you'll get an answer involving C++ libraries that are > not going to play very nice with our error handling or memory management > conventions. FWIW, it's not uncommon to opt-out of C++ exceptions entirely, for various reasons. For example, the Google C++ style guide forbids it (if only for historical reasons), as does the GCC style guide (since GCC was a C program until several years ago [1]). Sometimes, these third party libraries that mandate the use of exceptions do indeed create significant headaches for Postgres, compatibility-wise, but that isn't a given. IMV, it would be useful to use C++ classes (and even template classes) for a small number of data structures, while still largely adhering to earlier practices (this is what GCC did). Specifically, a few modules such as StringInfo, could be made to follow the RAII/scope bound resource management usefully, which doesn't seem incompatible with memory contexts. However, this doesn't seem terribly exciting to me. [1] https://lwn.net/Articles/542457/ -- Peter Geoghegan -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From Jim.Nasby@BlueTreble.com Tue Aug 16 20:36:37 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZl6D-0000XJ-6b for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 20:36:37 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZl6C-0003sw-GA for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 20:36:36 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZl6B-0003sq-RV for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 20:36:35 +0000 Received: from mail-sn1nam02on0045.outbound.protection.outlook.com ([104.47.36.45] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by makus.postgresql.org with esmtps (TLS1.0:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZl68-0003W7-8g for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 20:36:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=BlueTreble.onmicrosoft.com; s=selector1-bluetreble-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=rlCYYQ6FQpht87FwbAmJiieUr7PWW3lQ7gnD2bd9q7Y=; b=YX2DUVasW9F7UucmYyX/jjJ9LB8GEOSOqt5+9BlRtY5FhoiCJ0Ztt+CdTv72VRLSILljmYozK7SLlsTHdufdkPzKpm8dR2N0mWEPHgJEVNV+/t3EH8INHnd5qfRteCPvNkFjAj69JL4XIgHM1ftlRvwH/pQbBCbc1/jOfY7vgDs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jim.Nasby@bluetreble.com; Received: from decina.local (70.113.16.71) by DM5PR11MB1644.namprd11.prod.outlook.com (10.172.38.15) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21; Tue, 16 Aug 2016 20:36:27 +0000 Subject: Re: [GENERAL] C++ port of Postgres To: Aleksander Alekseev References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <20160816183940.4818d854@e733> CC: Gavin Flower , dandl , 'Adam Brusselback' , 'Joy Arulraj' , 'kang joni' , 'Dmitry Igrishin' , Pg Hackers , Peter Eisentraut From: Jim Nasby Message-ID: Date: Tue, 16 Aug 2016 15:36:19 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160816183940.4818d854@e733> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [70.113.16.71] X-ClientProxiedBy: BN6PR08CA0064.namprd08.prod.outlook.com (10.172.144.26) To DM5PR11MB1644.namprd11.prod.outlook.com (10.172.38.15) X-MS-Office365-Filtering-Correlation-Id: d44c65a2-4e81-4a6a-6e20-08d3c615007f X-Microsoft-Exchange-Diagnostics: 1;DM5PR11MB1644;2:zeZLwSj4xaD9ilYwMmQOl6nTCKL45UzAn6oW+w3jGnl09Rt26luHemu2X7cvy7ITn9M7+Eh460VDnIWwZSAZjAQeD+5Z8iRydqAFcwmS+66cscmdPXcuWOrM2aQwK7AKs7+yUm+nMmssUUnvXlSlb+onX/kOgNv1qg+0/iIuy/pqNx0dilbrbf5Cd0VS9ACB;3:eP+E9kpBDaIXZG3wks+fghQ9DypC+O8xCLTLMVYYT0vj/LKwilmqWHy2EGHNlPlf/Ok5famv8Vr2e93lB0W8jvZl6Nw2Ia/HMLRCZGze+RV8ujGdwC47gQdpqYiJqsCd;25:RAFOT/sCR+HDqO7UJABSNsYdN2KMzz0Qv2mvC3nm0VFRfvbaLcB0RLwLvbOWEdu9Sb5HrEn5XKI2pa3IYFjBCCodl+pe6gIDt6UyJjk8bBVtrefmaGQzSEOs6doapIbNNhzapSNDvMO2s4GvXa6aIhM3hFOpDoiD31rrmylAMM4PXi3QlbWR95ox78R+piF+V3KQcojfFH9dmXIYkORSocVWHKZYAHFY0vAaolunhlxK4efG6g1h6N2tArcGafbk0NqNGb73pvwugh0JIX4zyUqHUTagscCoaVcoeKpQBp79BiGgx0LAPx2ndw32sOrBR98BFbCnIMqIZ0dP0xf+pbKx+uNxjJTXG4yXwSglMCa8FT7z3vLRZ+pBT2T9iqxaU5PVqVmeDnZi4RaCXigaXACmLU5UVPAL+YXjyiGHe5w= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM5PR11MB1644; X-Microsoft-Exchange-Diagnostics: 1;DM5PR11MB1644;31:YRlasyIemGlLFO+/2gZj+VJa0PS7NBPVDB//hcShtDShrQqPPAUcJfZshbnykshGJAGsqRJVxXSrFZ/3Kt2U+0NnmdQOP3BHms7GdCQp93S0BPlchmjuURdRNJEJGp4d4ACnGPT6nAnuoGWEh/GdkYGO5bnzY2xaFsDJTUahw+wO2KAzzClX+ELfPQtcGwlbYT3/PuKkTozRRM0w/h9dbmvJCIhw5iWTeHZWFCowUjk=;4:JsB3KU0AM9BhrweDxUrMETHEt4c2oMF6kj8N/uZTQRk7dMwgUkTtYSV1m5DVleBQZhnvOOq8sAhaYqlMLfg6WB3adgJnl12CVx8/3oDf3Jg7t2hnIajgPbeEMfSqiKYJatBqca+3BVA4ld/FyTK1Q3G939rr1eNnqzk8TiNHGXvjxzZcb0/vzacuwk+Yotrz/+Wy5QGurbddntaxhLcOzlI0EBKedWcuzeN4shFk2FwFeFj2a1kqWXrriAXxF793ftf0WEHAtHWxhXyS5Jnn9/lV/NHwtILyAEnCwiiu76C50HGr4DyYvweECYGbYiY0fvv5N5Uo2c5GkT4RjkCBkDkxEcrsiXx+pEYG0MTuZjHgeTXV3N+vIuusWDXjvmz3CxMpgyKt1Jrc0PE5Fjzj1odtKijNJHTfIugEB4h4fEc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6043046)(6042046);SRVR:DM5PR11MB1644;BCL:0;PCL:0;RULEID:;SRVR:DM5PR11MB1644; X-Forefront-PRVS: 0036736630 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(7916002)(377454003)(189002)(24454002)(199003)(57704003)(81156014)(230700001)(2906002)(4001350100001)(50466002)(31696002)(97736004)(77096005)(4326007)(76176999)(93886004)(66066001)(92566002)(15975445007)(50986999)(23746002)(2950100001)(54356999)(64126003)(47776003)(19580395003)(86362001)(101416001)(305945005)(3846002)(7846002)(7736002)(81166006)(68736007)(6116002)(106356001)(586003)(42186005)(65956001)(36756003)(16601075003)(33646002)(110136002)(65806001)(31686004)(83506001)(105586002)(8676002)(189998001)(65826006)(85282002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR11MB1644;H:decina.local;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: bluetreble.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DM5PR11MB1644;23:oRNgX1tJ5bT4r7RJIJxW98N3gNSvIKPtKIHXn?= =?Windows-1252?Q?gZhMRVAFPJ0bnSEqIv6D67tjHpc7ZRADMdJkdknkyhYkD43bCvozd0IU?= =?Windows-1252?Q?Wn39+43k+t6KvXiCSGcilsK8rMO4KTlzGsSG1fgQ92IY4Gb3FdJjIcKW?= =?Windows-1252?Q?qyl+Da+wRzSLLHYPawYtSBuw/FKc9wzhii/jzLgYG/r+NdipeqrCvRLp?= =?Windows-1252?Q?TSNY9xyjt60AV0TE9fbQx0WOzNPopfRH9pefWnnQtb43TrINz6YbciRe?= =?Windows-1252?Q?WWizYdDY8dHxkuQvFjDwPhzeYp5mAvzr6/N3S0NGQoXi27lXpTMQpba0?= =?Windows-1252?Q?w99hlMnzhE60HVhFI9qi6WkZEX2l/6wn/k5XDE15i7ltpnT9+2SK/PYQ?= =?Windows-1252?Q?c3KSmAfBBJjSV11n4MuX6ThYXJGAKzkBn5yRGqbkmob0Ub4bZtDy0N7f?= =?Windows-1252?Q?PwOH1d8BiVheSsuIoYzQKh1Qi6Lc6B6+XLzBOF4C8NXzEW561bl5loV7?= =?Windows-1252?Q?Q4V9s6wWeindoZ1cd/0GPuirJfmWidBiwNhUKj1s8qBWBntRaYHYHbAT?= =?Windows-1252?Q?JAuKdJkFZD+9/2xWIfAzW/LInM+A6H4HQXE5nXu8Rt3ScBV5ZgkmkZZe?= =?Windows-1252?Q?G0Tg6IUEpB5rxlY4xGBmKO92dc/0Nvuh75kxUruj6LrJIZ0ECAaI7dpb?= =?Windows-1252?Q?v6DlgHN3qFdEL4RF8LC0+gg7R6XqQxTjyBP6+pOdFNTHwhSQ20giFPf5?= =?Windows-1252?Q?l/aFay7HrwXmBrHc781AtzuXnK90noGhUbw8p07LJSpCVdxUt8+l8Cci?= =?Windows-1252?Q?FyjFva0wH0+cugHmiN6ntBBc2hZRPzIqzKpcQeBX7slMra7xvts5rbd8?= =?Windows-1252?Q?1PrmoSBEyskMhBhKi+rrzU4UaKhov41HS/kEZ8Gtej9GgU5OuXAtrOjD?= =?Windows-1252?Q?Mkwnj/0kZ5Wos6ZHc4UBHTqQJ3A2SPnQKiHnMcHt79gOYSqKpts8CcxA?= =?Windows-1252?Q?6tXgkwIpIgQUTEZXrmA0MXb59PlcaRGnyaCFLxDgnTbgbDmDBpFZ+HCl?= =?Windows-1252?Q?d52um3yH5cv79a7pKbrhY4ntXguRC+cE4L+1p4R5X7KoolnCAfItzQ04?= =?Windows-1252?Q?WhYa/+HmgmBdNBJ9iWNDLmiORF8yaRJPtBvX2I5oto5WjpdFLgdVKKH9?= =?Windows-1252?Q?E5CEjgzx740W1UP3CdibOmhg7jakhK7+v62s5zi1B8roG1VgUQRy2Xlg?= =?Windows-1252?Q?jdIqIvJHbGIa5H7xdQZ/sqvuxiFNJWxcmJCol0Wmf6WwYARtsWz6wisL?= =?Windows-1252?Q?Gm8tcqPtxTsF2HGeMbEQNtxhNHTXTBsMkTCIK6ZH6f9Xm2qV9+2vQGFZ?= =?Windows-1252?Q?B4rVeF0Smko5FRCzZ8AkjSUDb/7UfMXajhxNw+QIogJPaeYb9T8R16cc?= =?Windows-1252?Q?oEKihYSS2dEWfz0JJr8?= X-Microsoft-Exchange-Diagnostics: 1;DM5PR11MB1644;6:zwMwzRXVgpiZ0+ln/Gyj4cGydoAGP+IB9CmeBiBElyVCrWRCho0G6t9wSSvlrS5mS9hd/57R9w/yEqNV6gu1ROicIVMEMfcwnbT9m97SBd2V8HTaY5mEjb117He6n0D3uUJhXgZPO0z75JvPVYpV44KLxiRZREQj/Va93S2RKDLCLndc43fu8MPnRHcqvNcWxAS2BZzqGO1UxWaYUx2JPoh7UABshUQ6aHzTR1max2DhDjO/xZ4YiQYu4pOXjntyJt0Uvw+1AdN7CPfjugcNpnhCzfEHmPSnOJ+wXhAmgWera8U3fpcC7KDjI1fUkk8z;5:DRcbKTl738yQu8ZHKUkNDndDr1v+2Vv4vSzWVTH6mcr/S1Rl00ZtfNY9nUFV9hLGyKy7LDvYEHR2ApCfeFB1jkpxmHWvtkd2pmBuJseL3bRqF+txRojZreXxS5g0WlFIY/VI5lT5m8uQwR1RWUNpVw==;24:rosjM/iNx11HQ8iupI7DuATMEPk4MEINJFG4ahcTepIYmt4NTO4igwVNIR6HJvcZBWwYdYk8aTjfx7HJcxWR+yZ7ltXtmw0+xta00AfM+hI=;7:TWPJhupKDMFTLt2mFeWcr1E3dAfoVQ2gOWhVzu7mu2OsWjH5JKgzbtIYz/jLns465UPL/wbHleYLkOfERwampJg2lP6ImV7Y2etczf8ZmFVcDpdygIS4NKe9PP02lWoM2dK16r1JTUEHd6QX7MjFTUMLm1GOtF+xQVenQS219UfdmIr5+fPon6b7goa0slWkJtDyiimvbKbhI9ofMrFk3a/B6iAD7KHcW8Vwv+cExCntD63dYQEsNpYA2SI5reXY SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: bluetreble.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2016 20:36:27.1336 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1644 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org I'm sure this wasn't your intent, but the tone of your response is part of why people don't get involved with Postgres development... On 8/16/16 10:39 AM, Aleksander Alekseev wrote: > Well, well, well. Another C vs C++ holly war, really? Please note that you're the only person in the entire thread that's said anything to the effect of a holy war... > Who are these "folks"? How many more developers it would attract > _exactly_, not potentially? As someone else (Robert?) said, there's a decent chance of it attracting some, and it should be rather non-invasive, so why not try? > One again, which "people"? I've seen people complained that there is > not enough code reviewers and testers. I doubt very much its something > C++ will help with. Will it suddenly draw 20 people? Probably not. But if the community actually welcomes the effort Joy put forth and encourages him then we've very likely gained at least one more; maybe several. OTOH, if the community takes the stance of "WTF WHY DO WE NEED THIS?!", we've just driven Joy and anyone else that's a C++ fan away. When it comes specifically to reviewing and testing, you need to provide some kind of reason for people to do that grunt work. A big form of that is supporting people who want to change something about Postgres. (It's certainly possible to get non-hackers to help with this stuff, but that's a different discussion entirely.) > And I wrote a blog post (in Russian) [1] in 2016 why nobody should (if > they can) write a new code in C++. In my opinion Rust looks way more > promising. However I personally prefer to wait like 5 years before > using a new and shiny technology. This is also something I blogged > about (in Russian [2], translation [3]). I agree that Rust is more interesting than C++. I think it'd be great if we supported it as well, but I don't know how practical that would actually be. Note I said support, not use... it's going to be far more challenging to make Rust (or even C++) a requirement to build Postgres. Maybe we'll eventually go that route, after demonstrating the significant benefits that would need to exist to make that work worthwhile. It's going to be FAR easier to demonstrate that if the native project at least supports using it, vs needing a complete fork. -- Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX Experts in Analytics, Data Architecture and PostgreSQL Data in Trouble? Get it in Treble! http://BlueTreble.com 855-TREBLE2 (855-873-2532) mobile: 512-569-9461 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From andres@anarazel.de Tue Aug 16 20:38:44 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZl8G-0000cp-FV for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 20:38:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZl8G-0005Qi-2R for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 20:38:44 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZl8F-0005Qc-Hs for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 20:38:43 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZl87-0006cr-Sa for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 20:38:42 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 25C9E2035D; Tue, 16 Aug 2016 16:38:33 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute3.internal (MEProxy); Tue, 16 Aug 2016 16:38:33 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=el8xJ+6ehX4RBYVjOpE8OR5mYRs=; b=AUXmN c5gq5LWuYMIT4loJpidO2dXmh8xEwS3akffZbrjQrXyRmJv37Il9caNxoqub9YK1 JsYgiv8/w6Qo85Si0M//qKQvhtxJ2jba/0VFZIKMYByqYKZxS5P6YdlGudf/30EY diffbY3c3QCswaeCGWCtq0UAcBqSwcodhjTCWQ= X-Sasl-enc: ttM7KkT6lyYEBBRgNKDAoOppEHV9ouopr2AhbYZ92puT 1471379912 Received: from intern.anarazel.de (somacentral1.static.monkeybrains.net [162.217.75.74]) by mail.messagingengine.com (Postfix) with ESMTPA id B1443CCE66; Tue, 16 Aug 2016 16:38:32 -0400 (EDT) Date: Tue, 16 Aug 2016 13:38:31 -0700 From: Andres Freund To: Tom Lane Cc: Robert Haas , Jim Nasby , Gavin Flower , dandl , Adam Brusselback , Joy Arulraj , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut Subject: Re: [GENERAL] C++ port of Postgres Message-ID: <20160816203831.bbgk63l5c7xl5wfq@alap3.anarazel.de> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <27271.1471366764@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2016-08-16 12:59:24 -0400, Tom Lane wrote: > I'm pretty dubious that it really helps people > to develop extensions in C++. Almost invariably, if you ask *why* they > want to do that, you'll get an answer involving C++ libraries that are > not going to play very nice with our error handling or memory management > conventions. I do not see how we could C++-ify the error handling without > making a complete break with C compilers ... which is a step I don't > really want to take. I don't think it's *that* hard to make our and C++ error handling play well together, at least when compiled with a C++ compiler. > The whole thing would make a lot more sense given a credible design > for error handling that keeps both languages happy. Using C++ exceptions instead of sigsetjmp()/siglongjmp, when compiled with a C++ compiler, seems not that hard, and could easily be hidden behind PG_TRY/CATCH/RE_THROW/END_TRY. We'd have to hide the "bottom of the exception stack" cases like PostgresMain() behind another macro, but to me that doesn't sound like a bad idea anyway. I do think it makes sense to work towards being able to compile postgres with both C++ and C compilers. Most of the work towards that is pretty boring... > A lot of the other things people have muttered about, such as heavier > use of inline functions instead of macros, don't particularly need C++ > at all. I think the more exciting bit is type safe lists, hash tables, ..., without having to use huge amounts of macro magic. Using actual inheritance for Node* stuff would also surely make some code better checked (checked casts) and easier to write (less pointless downcasting/upcasting from Node). -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From pg@heroku.com Tue Aug 16 20:40:13 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZl9h-0000hM-Eo for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 20:40:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZl9h-00071r-1Z for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 20:40:13 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZl9g-00071M-C6 for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 20:40:12 +0000 Received: from mail-ua0-x229.google.com ([2607:f8b0:400c:c08::229]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZl9c-0003Y9-L2 for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 20:40:11 +0000 Received: by mail-ua0-x229.google.com with SMTP id 97so141398833uav.3 for ; Tue, 16 Aug 2016 13:40:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heroku.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qM6GcwfOgm8saAe54E1oMWv25fH0U5nEYgmx1GsUoGA=; b=xAg9xMZ7WBlGiaq5wlbdtjDQ3TPSj+Xb1pdUN22eHQ0jeRtEkmKhS97NDLsxfK7vnd 0FYx2AxliYWybb/8dy1cJsnW5qMf+1p4CNxW52CQhG432STJ1TfQpDc8KVJ2lH8qbwz1 qM2Y5qJQhdPWFI7N3oK63+lLYzC2V6RfntwCE0sb+kdJwAGAmUqlOEsruRaMo3sFPI4Z QGSmA85Y0b6qt8hBLFMyqyusIqHmPtLadfPc6SOH7O4x8INXaSR0YUIgHJ0TPoUNYcM0 576WQclEmQiK/Rk2SXRfMBU8EWwSATVOC/giqnnZ5ECfKiVQkJDyhYq4C1OYt/UJP3LR NPjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qM6GcwfOgm8saAe54E1oMWv25fH0U5nEYgmx1GsUoGA=; b=lON9sC/G81Rx38MBkR6oeV54vtxRE66l5jGIwjRy30nI5EQiB/rIAcW9H7jT0UJMAP GiK+ZxOKLEiMbh0rCHNjBZ0iVoMILKrbBK/Li0umky3g9QkQx8lkvSBF2DuLHTxZbI4R 54aHAZIOPIUNkpJxrNIUzaudNFRkaSoz2FMyyXlaPho0oz1NLCT2gS4k/gXS3t2/jA3R UdfApjCfHS9OQn2aKQdHxdbCZJdxhSLDNzNniOlkgdno40czRP/O76Zz0KAof4apFhaE XY8PCSzR1z+32kh8r9ioxUAolCH7UY9SO4RGMTRQ5WZBTm8Vw+7USo+wATj38pnQcAoX 1xDA== X-Gm-Message-State: AEkoous99R8EFtObv4JNl4aqjHRC+8AKQovtAiZUPSItkeAlWvM/xQ7IYQVE9thRQXvvZGH7h9ldgFdq20Lr25ts X-Received: by 10.159.32.66 with SMTP id 60mr14372512uam.125.1471380007486; Tue, 16 Aug 2016 13:40:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.53.195 with HTTP; Tue, 16 Aug 2016 13:40:06 -0700 (PDT) In-Reply-To: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> From: Peter Geoghegan Date: Tue, 16 Aug 2016 13:40:06 -0700 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Tom Lane Cc: Robert Haas , Jim Nasby , Gavin Flower , dandl , Adam Brusselback , Joy Arulraj , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Tue, Aug 16, 2016 at 1:29 PM, Peter Geoghegan wrote: > IMV, it would be useful to use C++ classes (and even template classes) > for a small number of data structures, while still largely adhering to > earlier practices (this is what GCC did). Specifically, a few modules > such as StringInfo, could be made to follow the RAII/scope bound > resource management usefully, which doesn't seem incompatible with > memory contexts. However, this doesn't seem terribly exciting to me. Actually, come to think of it, I guess this is wrong. The problem with what I say here is that longjmp() and setjmp() are incompatible with the stack unwinding used by C++ destructors in general (exceptions are another issue). I think that the practical implication of that is that we can never use any C++ feature that hides the complexity of resource management, unless and until elog() is reimplemented to not use longjmp() and setjmp(). -- Peter Geoghegan -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From Jim.Nasby@BlueTreble.com Tue Aug 16 20:49:56 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZlJ6-0001HT-LJ for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 20:49:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZlJ6-0003Rb-83 for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 20:49:56 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZlHh-0000RS-Bb for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 20:48:29 +0000 Received: from mail-by2nam01on0085.outbound.protection.outlook.com ([104.47.34.85] helo=NAM01-BY2-obe.outbound.protection.outlook.com) by makus.postgresql.org with esmtps (TLS1.0:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZlHd-0003l5-Pb for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 20:48:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=BlueTreble.onmicrosoft.com; s=selector1-bluetreble-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=qdtPWm6i7hZtoqJKfm+lLOuU1EqpECjErIS9iwnoeY0=; b=YxaPlGyLkE3TifvmrnrbZN8bnIjmZcp7Y98wYa84SqnkfxjNE+7GgGX08M+dmZ9FHAW1TwZG9GxCz5MMtambfWUSA5QhnywiDxabO3j6ho6a9GBCbnlIgiJUASjR7yTDeXSkuiXzu6kil7qAbb3/rZKwpMB6JjZGMeIuHuobujo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jim.Nasby@bluetreble.com; Received: from decina.local (70.113.16.71) by CY4PR11MB1640.namprd11.prod.outlook.com (10.172.71.16) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21; Tue, 16 Aug 2016 20:48:12 +0000 Subject: Re: [GENERAL] C++ port of Postgres To: Andres Freund , Heikki Linnakangas References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <20160816202928.v62426ta2w4yauk7@alap3.anarazel.de> CC: Gavin Flower , dandl , 'Adam Brusselback' , 'Joy Arulraj' , 'kang joni' , 'Dmitry Igrishin' , Pg Hackers , Peter Eisentraut From: Jim Nasby Message-ID: Date: Tue, 16 Aug 2016 15:48:00 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160816202928.v62426ta2w4yauk7@alap3.anarazel.de> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [70.113.16.71] X-ClientProxiedBy: BN6PR08CA0056.namprd08.prod.outlook.com (10.172.144.18) To CY4PR11MB1640.namprd11.prod.outlook.com (10.172.71.16) X-MS-Office365-Filtering-Correlation-Id: 7ce396fc-f4fa-4120-2dd8-08d3c616a974 X-Microsoft-Exchange-Diagnostics: 1;CY4PR11MB1640;2:jQMNH0HiWJAlI8PheNrNescj2w0OR2iYO+64O9u/K0XIy56Ff18KPeL2OgA9JYWuY+9IYjFc0ly+VhPP4SoFHVCVTB3TuknvJtDDbDqmtFbdLZkowwTLmTOdXlYzvBIZ90IQaevp1Z4Euhbxs24yXCRNO5P1zyfQCNXy8zOH8sv/Ebi45HlBPaizC4xQDfsd;3:k5q9s3SAM6KW+gWJb2jywySrYXX4x4UagL8Nyar6jMWwAPWTe7NwdkuGM7AWdl6OGyZljU7CHnibQ/p7T+MBWnMP8dqI+14b6ZsmyHO6i0vU86WR49lh61ARbCipWwsu;25:dhGn8hcCOWPL70x37bBVOqRaRCC1cVZgmaOdCM+VxCwp8kwiLTSO+6RRYnZuVLxbY6AM56uz5F4qjLQV1MO9ug+FvoC+HN6JLHdmj38K5pAq4YB31C1cgyarSaMY3nYJUAhELb8c6LEqug24JDnMG8UCPLsp9Pv2scnCkGw7W+etKwEQVxqrF2tpSB0W9bs92TCbyAmHtcUdcoZJxf6jurpcOe1CJo9hBisJpFu4057HgHyIONsJ5uKAr7ynLUWtHKH1AQMXXTiZDQ9fIiAq559VlAEVCslUvgAZTPTr5+QRMXl/w/d5/7BQRcNywnAMrpuAbQBKDvn026Go5BHlEDoarUW0NMAH6lEHR6HVoM+yT04XCqAjMAm3TT+bb//PnnxIMoUGNsw9HpWzti82ui0WJQEZM1YMRnBInyQ1ErI= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY4PR11MB1640; X-Microsoft-Exchange-Diagnostics: 1;CY4PR11MB1640;31:mymAJb+t341ymBRFAll5lVcwgaMbSWzK9x2PhEZYBXDMWrArcHtOO3BNIiowyPA4uappIr5jx+u1OdtLEA1o1GIRQvRCvCZAAP/9Si5/IjsfKtTaPcPuvAlJm+N1YM+3EynnvNPr1zk9fbBRZ1JbkY4LjaDUEMIRSMndgYFK0EGYBHq83DqqfcYnwhxihIPpIu2uP5A5zHHSYZxTmGrVtwm5b5ofQKP6bQgRWAMBTxI=;4:Bx21B1H5BAoKDfcJS8Dmcmp7lD04zbrqqkdq8FI3il/qq07BQ4cBtEAHGdpE6xQb6liow68qLC5truOQLJvV+4/y1/lPBzmZGyynnNrJn4C7Wo7RfWzdN/j1lQVApF7ReS8SU4xonZhilBk1ybWW8DVv5s4d7Fjcrz3aFrYUVVNluA2n7Y7Myjx+aRLhM3a6Nm7ZUN2h3fuL7nl6HkcOb4MQ4S/tIUzVxfhCmJRlMTS7bETBEPz3uwMwArLQXrxwiQ0CZoZmLM3ewlASvQpRls//Qpt7FDTXcfd+4tKowpefnxuQhsy2n+oJotfAVOul5gGt0/y+tWi08CEKHD1UTUPU+uxKj4UZNocPTmQACpJEPu9pAE1cHOJYWT/Wo7dOguBdwUWTO7nPLtcvupdfI3Pjhzh1t+xcNpGCRzsW+eQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6042046)(6043046);SRVR:CY4PR11MB1640;BCL:0;PCL:0;RULEID:;SRVR:CY4PR11MB1640; X-Forefront-PRVS: 0036736630 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(7916002)(199003)(377454003)(24454002)(189002)(586003)(54356999)(2906002)(3846002)(76176999)(7736002)(68736007)(2950100001)(97736004)(6116002)(5001770100001)(23746002)(65806001)(7846002)(101416001)(65956001)(305945005)(19580395003)(66066001)(189998001)(230700001)(64126003)(50986999)(86362001)(4001350100001)(7416002)(16601075003)(47776003)(50466002)(33646002)(4326007)(81166006)(8676002)(81156014)(15975445007)(31696002)(42186005)(31686004)(77096005)(36756003)(93886004)(92566002)(105586002)(106356001)(83506001)(65826006)(85282002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR11MB1640;H:decina.local;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: bluetreble.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;CY4PR11MB1640;23:ktVDbWsUsL22VMm/NUlzMsfOXnOeleF3QEUkS?= =?Windows-1252?Q?lkJ0Xcq20QYA3VVvM1+SsjWz/tcw0v10652M0ySDTKj7uNRwutwsM+D5?= =?Windows-1252?Q?qEvJfPIEJmY9IYK5+5a0OrZf4dyuuu3j5+1YKsqM+meecKWW4IUbavZE?= =?Windows-1252?Q?wGUH8kmWNdEFJSqoYbOScI+vFAunmDKxESL576fm/aGMKt+w+mp0vQ52?= =?Windows-1252?Q?vKL2QPhiyxQ5xFmJ6bykkL+zl++VPcAh9AL99HNnjxGxve/xqwkwnwLM?= =?Windows-1252?Q?q4u9Pt17Zpnho1WpRKx7l/Kr3vwZEK0syjTgg9LgIzCZt97ID2D7NqlE?= =?Windows-1252?Q?f1aYTf/+IK/COgEtdvkNdgzqjtC9aQoEqubQ3xu4MbMA3Z72GMGexEYb?= =?Windows-1252?Q?+MBcpJDejkMPwT6mjJegAufwhCgYS9UyW+jl67nvPN1MyNqTSrylRx7c?= =?Windows-1252?Q?GGtHGM8CGq1AqVLIM9AMLMS2XxNkt31LO4pVxRFaz1Qy4mcERll3O3Iz?= =?Windows-1252?Q?89txU5ffrwuhNJ2CuEsA+kKXBwBz7lFeGRouoDMx02oSQivV1gMbYiRf?= =?Windows-1252?Q?afo4/LyteJcDap5o4bKfxqGkHHEgGJtvEk4+r/hytwNIzeDiRSI/CciC?= =?Windows-1252?Q?Wu+hLMk2eUjj+1zdmlqwAW3fsQikoQtkD9IIkvnGOewQcIW7TZlAYajV?= =?Windows-1252?Q?nLX4Trgeh1p4MY2avJWIVaaV7ixsPO8HA1L5bsqGNPpUGThrpT9GF+08?= =?Windows-1252?Q?sxjDEwrcjyaSJIlLMqu44ZmK5Gv5Xzl0O2SN/0M/e5wU6KoSanjjB1rc?= =?Windows-1252?Q?jmHtdTDvQQM1E/qdHfgv6Fqkut6wsgX6E9ly3JDLsEGY+Do0HjvzmR+l?= =?Windows-1252?Q?IORFBPb4tiPSp+qxS167LiYNekBtinkrBmO5hCBNZ3FU5ykNnIl/+epG?= =?Windows-1252?Q?kdp/zIZ7Wa9oA6n1ZXL5RI3K5ODlI56dzUrqgPLQWsVnl9ZCOCWOHZ1K?= =?Windows-1252?Q?hfY9a9r47XRJGNeGYMWh51yzOkzyR1YpTzcGksfM1eGH1Pd8dA3arZAQ?= =?Windows-1252?Q?F41nVnlTDn3UlAzIjPSFG+Q6RwD6MN/giQ8oZ9zeP1D7SZk5nrw7I6ES?= =?Windows-1252?Q?gsCDkXZ8v9vG1TLv0FeHr9bKUcXIEIrTP0SW8Voja4iPtXCTU8aGoyD6?= =?Windows-1252?Q?lyrPnQiw81Ue3FxA6nB2Aoz6v3ZD8DtuXKbH+CUMN3qBXCjGmov7UzBb?= =?Windows-1252?Q?8K9l4cPpuOWAL7dF9G+kaSpO3Z0R2UhXHe16ET36HsvAXZ2A4JnaBwJO?= =?Windows-1252?Q?kseSWfD1r4/cVlPGSCPZeo0iSSIDL5tATaEgRMyaXOIqVpKFga+CP/2u?= =?Windows-1252?Q?putGFNefAQ6EZK/BdVDpDGWpOqnjX0rVp8Q8OjwyjOV3kpHJNXzpPSGG?= =?Windows-1252?Q?yCjwahACCiN9OROTMVY?= X-Microsoft-Exchange-Diagnostics: 1;CY4PR11MB1640;6:OUolzv4q/04Xiu1RBPu4FNTKqOVZSFjzS0E51NpcNnPBTGsJY1uwSU9WmjFkEEPoKb+iXNd1jgngkopZ6zI7zwuzWt9N16N73rzx71ypWrgo8TtCnWyVipfAEf1whh1Gv9CKQeas8JAEWt4Wq0p6ACNJMVtXPCi1bC2S54n74zzJZAuulA2W2Nazo8Wqdk32gO8WmsTTMOILtFaw+7bbK7wNbFAe9hZt574C6gbeyGIkS8nAlwsLXs1g/8su8bNegzo+hlB44Vkr7U29lilkORz+JgHyMfh6jg9+Z8p9I2BJEZS1m7i8vK5eCGCqeLz6;5:chaDI/wzV5ywqsC8+ucWqgJGJdJRmmGCEGi9v2qMK0j19R5gSRBvLgMAtRBf14TIkilrzjrIbDS8LDGYFzkiqPTMPac9YS5aSFbppHLQIvtAbCTzliVa0mc1/0kLPz7kcA7fuVA5i3sd7aS712zWSw==;24:+VQBkOuid2HyiYc6lUvqQjUOnl7o+Hqsd+WnQENePp7xzaLAu25nHWSZWidL2TmNtp9SAh6+6YyH9WKrioxOb5sR970PBkrVebwVzgCny6Q=;7:z+LqGwwTDYWt5d2ts7MaMcxvh2uEj+M0z0KTXp21nW9i/xuDSnu4jqBoHf1vse1Iv5iOuNr1NZIh1heIpOMeSZ+GMiKiy6K0soS/ARQwh0u1sox+Q2HjhdpvI+Kv3sGhP5kbvSsxLOcA9jz/6ZM7VPWEjD2Vfra+hov2tggbrzRt53LcSvScnHbnxtfYBSQgrSkvkai2jQWyR/lyugmwu6N5DcfIIzF5wLg88vTDomXwLILC/TdZuMgjaZVWtUB6 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: bluetreble.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2016 20:48:12.5773 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1640 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 8/16/16 3:29 PM, Andres Freund wrote: > Well, having typed pg_list.h style lists, ilist.h linked lists, > hash-tables, and proper typechecks for pg_nodes.h instead of the NodeTag > stuff, would surely make life easier. I certainly wish parts of the system brought code and "data" together in a better way. Nodes are an example; all the Walker stuff in the planner/executor is another. (I'm not saying C++ would make that better, just saying those are parts of the code I find it much harder to grok.) > But given the small subset of C++ available on all our supported > platforms... I think we'd first need to make the decision to cut support > for some platforms, before using C++. Which imo is a distinct task from > *allowing* to compile with a C++ compiler. Exactly. If we at least maintain support for compiling that means people can experiment with other enhancements in a way that's much more compatible with normal community contribution practices, which makes it far more likely for that stuff to be accepted. As for the backwards compatibility... the stance I've seen the community take is cost vs benefit. Right now the benefits are completely hypothetical, because no one could realistically propose a patch to use C++ (or maybe even Rust) features. -- Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX Experts in Analytics, Data Architecture and PostgreSQL Data in Trouble? Get it in Treble! http://BlueTreble.com 855-TREBLE2 (855-873-2532) mobile: 512-569-9461 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From andres@anarazel.de Tue Aug 16 20:55:30 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZlOU-0001Zr-O0 for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 20:55:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZlOT-0003rR-SQ for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 20:55:29 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZlOS-0003pQ-Ux for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 20:55:29 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZlOL-00072c-7j for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 20:55:28 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 9874E2042E; Tue, 16 Aug 2016 16:55:19 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Tue, 16 Aug 2016 16:55:19 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=TKtJEZ/bkJaVsANB4YVQ1WgtNBA=; b=P5yv0 2ncz8QfQ9eE6yG6OUsQUtZEXZ8ZGjjGCDiohdYz8JajlXHrMEKTtatbPmHidNyX8 YmNq7D49rnbp059TNyVdjxJa0+RcTIYvdVjSGCsT2pHXjF97yjq3Gmq+7XLo48Hw vmEhFugs6g5mNjBUqDxfelszpQjttMZqAifGf8= X-Sasl-enc: BHFZUdEousF8DxGyEvlSmuPzpIB05gNScOKeUC+PMFgk 1471380919 Received: from intern.anarazel.de (somacentral1.static.monkeybrains.net [162.217.75.74]) by mail.messagingengine.com (Postfix) with ESMTPA id 33E7CF2986; Tue, 16 Aug 2016 16:55:19 -0400 (EDT) Date: Tue, 16 Aug 2016 13:55:18 -0700 From: Andres Freund To: Peter Geoghegan Cc: Tom Lane , Robert Haas , Jim Nasby , Gavin Flower , dandl , Adam Brusselback , Joy Arulraj , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut Subject: Re: [GENERAL] C++ port of Postgres Message-ID: <20160816205518.yesjo6w2t6os3kvu@alap3.anarazel.de> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2016-08-16 13:40:06 -0700, Peter Geoghegan wrote: > On Tue, Aug 16, 2016 at 1:29 PM, Peter Geoghegan wrote: > > IMV, it would be useful to use C++ classes (and even template classes) > > for a small number of data structures, while still largely adhering to > > earlier practices (this is what GCC did). Specifically, a few modules > > such as StringInfo, could be made to follow the RAII/scope bound > > resource management usefully, which doesn't seem incompatible with > > memory contexts. However, this doesn't seem terribly exciting to me. > > Actually, come to think of it, I guess this is wrong. The problem with > what I say here is that longjmp() and setjmp() are incompatible with > the stack unwinding used by C++ destructors in general (exceptions are > another issue). I think that the practical implication of that is that > we can never use any C++ feature that hides the complexity of resource > management, unless and until elog() is reimplemented to not use > longjmp() and setjmp(). FWIW, IIRC that's not true for gcc/glibc, because they IIRC use common codepaths. But obviously that's not all-encompassing enough to rely on that. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From tgl@sss.pgh.pa.us Tue Aug 16 21:00:45 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZlTZ-0001pw-2Z for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 21:00:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZlTY-0001Xn-LS for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 21:00:44 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZlTX-0001Va-KJ for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 21:00:43 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZlTU-00043n-E0 for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 21:00:42 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u7GKxu5p028201; Tue, 16 Aug 2016 16:59:56 -0400 From: Tom Lane To: Andres Freund cc: Peter Geoghegan , Robert Haas , Jim Nasby , Gavin Flower , dandl , Adam Brusselback , Joy Arulraj , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut Subject: Re: [GENERAL] C++ port of Postgres In-reply-to: <20160816205518.yesjo6w2t6os3kvu@alap3.anarazel.de> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <20160816205518.yesjo6w2t6os3kvu@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Tue, 16 Aug 2016 13:55:18 -0700" Date: Tue, 16 Aug 2016 16:59:56 -0400 Message-ID: <28200.1471381196@sss.pgh.pa.us> X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Andres Freund writes: > On 2016-08-16 13:40:06 -0700, Peter Geoghegan wrote: >> Actually, come to think of it, I guess this is wrong. The problem with >> what I say here is that longjmp() and setjmp() are incompatible with >> the stack unwinding used by C++ destructors in general (exceptions are >> another issue). I think that the practical implication of that is that >> we can never use any C++ feature that hides the complexity of resource >> management, unless and until elog() is reimplemented to not use >> longjmp() and setjmp(). > FWIW, IIRC that's not true for gcc/glibc, because they IIRC use common > codepaths. But obviously that's not all-encompassing enough to rely on that. I wonder whether it'd be possible to implement the PG_TRY/CATCH macros to use C++ exceptions when building in C++. This would probably mean that C and C++ builds would be incompatible as far as loadable extensions are concerned, because it'd amount to an ABI difference. But maybe that's OK. We could certainly have the PG_MODULE_MAGIC macro guard against the case. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From postgres@piotr-stefaniak.me Tue Aug 16 21:10:11 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZlch-0002AX-L0 for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 21:10:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZlch-0000ID-7v for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 21:10:11 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZlbI-0007AX-Vr for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 21:08:45 +0000 Received: from blu004-omc1s1.hotmail.com ([65.55.116.12]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZlbB-0004CA-I5 for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 21:08:43 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com ([65.55.116.8]) by BLU004-OMC1S1.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Tue, 16 Aug 2016 14:08:36 -0700 Received: from HE1EUR01FT011.eop-EUR01.prod.protection.outlook.com (10.152.0.59) by HE1EUR01HT024.eop-EUR01.prod.protection.outlook.com (10.152.0.251) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.577.8; Tue, 16 Aug 2016 21:08:30 +0000 Received: from AM4PR03MB1586.eurprd03.prod.outlook.com (10.152.0.51) by HE1EUR01FT011.mail.protection.outlook.com (10.152.0.173) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.567.7 via Frontend Transport; Tue, 16 Aug 2016 21:08:29 +0000 Received: from AM4PR03MB1586.eurprd03.prod.outlook.com ([10.165.243.136]) by AM4PR03MB1586.eurprd03.prod.outlook.com ([10.165.243.136]) with mapi id 15.01.0549.025; Tue, 16 Aug 2016 21:08:28 +0000 From: Piotr Stefaniak To: Robert Haas , Jim Nasby CC: Gavin Flower , dandl , "Adam Brusselback" , Joy Arulraj , kang joni , Dmitry Igrishin , "Pg Hackers" , Peter Eisentraut Subject: Re: [GENERAL] C++ port of Postgres Thread-Topic: [HACKERS] [GENERAL] C++ port of Postgres Thread-Index: AQHR9m+5v25x2yYJB0G+3TNz9JjyP6BI+nqAgAAJeYCAAAY1gIAAE4AAgAHl1QCAAB1QgIAAGJ6AgAB0AgCAAB2XAIAATLWA Date: Tue, 16 Aug 2016 21:08:28 +0000 Message-ID: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> In-Reply-To: Accept-Language: pl-PL, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=softfail (sender IP is 10.152.0.51) smtp.mailfrom=piotr-stefaniak.me; gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=piotr-stefaniak.me; received-spf: SoftFail (protection.outlook.com: domain of transitioning piotr-stefaniak.me discourages use of 10.152.0.51 as permitted sender) x-ms-exchange-messagesentrepresentingtype: 1 x-eopattributedmessage: 0 x-forefront-antispam-report: CIP:10.152.0.51;IPV:NLI;CTRY:;EFV:NLI;SFV:NSPM;SFS:(10019020)(98900003);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1EUR01HT024;H:AM4PR03MB1586.eurprd03.prod.outlook.com;FPR:;SPF:None;LANG:en; x-microsoft-exchange-diagnostics: 1;HE1EUR01HT024;6:vcbkH1As+rCbRYnno/7BjiRYD/KWZC194JxDrpxhcdmmPT7nhL7iF9ojnZzGD/+gk6pKSGXlwDtJ6VYn9AU/zzNCP5/SUAz68dtsZQ1CIfqhWhxIxoS6sAkPBNzcmVsrsV/UU68VB56KEJwW2MjykMscrnZ/ytYeZo2OuURbm/9npc7YJm++KInSIXSigv0QLQexXeAEFYA+5CUjx146fN9+NsnEplEftkIb/HF6k/02RIxC/Y0tuV1ZoDCISlW1MVtwahcDNvbS0ot0m24/dKw+Fq8p1/tn7onpmixr0HELwGtvAEcUlZuu9fs7QwR8;5:mOgKpjo3YpHbo0S4E9CvfEKwfN2okBgnjnw3OWi6vfywu58LMTEtRKlDQXo1xKm4qW9jo++EDYLzEy7BAS5WckZ6gFaKtxdqWzpuxoo3/4b1f7fPpCzB9BQLA9ZyJqu8jQNrIGJqwDYEFHQZTLAzUg==;24:WfDhFkCxQ4bqcQ7k7s2i3XRxSnYZr3p5uend6EBmRdPRLI0tCecWPlcPKUN8M8nC+smNgVrePmnew+rCNZH8XyWV/b1TGck4x70NSUb2Eps=;7:bGYjvZIHJ3V9CtZinzAgyZY0hsEwULavtRvpyLVtZcvAg/TLyzbAxWK0uQJ4bq3h9oyNYBXCsImD7/+JbhqsyV4UMOswBE92R8wPA+n/qcSdABGFO+J25Ii7lODndAO6+dl9vA59vZiuHaz8EPi0iuzLqU9llpOIyRifcHXdVbThddkBD440w9RE7jHCH60oadUVgln7EHMjiW+iEnth4uJpLvydY7Va6ULPpEL8/WxDAe8ZEoLUqhn2wi7v0Iqm x-ms-office365-filtering-correlation-id: c5d7b275-aeeb-476c-09b4-08d3c61977a3 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(1601124038)(1601125047);SRVR:HE1EUR01HT024; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(432015012)(82015046);SRVR:HE1EUR01HT024;BCL:0;PCL:0;RULEID:;SRVR:HE1EUR01HT024; x-forefront-prvs: 0036736630 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-ID: <99D5BDE03D417E4DB65F99D313DB1F20@eurprd03.prod.outlook.com> Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Aug 2016 21:08:28.2775 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR01HT024 X-OriginalArrivalTime: 16 Aug 2016 21:08:36.0480 (UTC) FILETIME=[5AA46000:01D1F802] X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org T24gMjAxNi0wOC0xNiAxODozMywgUm9iZXJ0IEhhYXMgd3JvdGU6DQo+IEl0 IHdvdWxkbid0IGJlIHRoYXQgbXVjaCB3b3JrIHRvIG1haW50YWluLCBlaXRo ZXI6IHdlJ2QNCj4ganVzdCBzZXQgdXAgc29tZSBidWlsZGZhcm0gbWVtYmVy cyB0aGF0IGNvbXBpbGVkIHVzaW5nIEMrKyBhbmQgd2hlbg0KPiB0aGV5IHR1 cm5lZCByZWQsIHdlJ2QgZ28gZml4IGl0Lg0KDQpJIHRoaW5rIHRoYXQgdGhl cmUgZXhpc3Qgc3VidGxlIGRpZmZlcmVuY2VzIGJldHdlZW4gQyBhbmQgQysr IHRoYXQgDQp3aXRob3V0IGNvbXBpbGUtdGltZSBkaWFnbm9zdGljIGNvdWxk IHBvdGVudGlhbGx5IGxlYWQgdG8gZGlmZmVyZW50IA0KcnVuLXRpbWUgYmVo YXZpb3IuIEFzIGFuIGFydGlmaWNpYWwgZXhhbXBsZToNCg0KJCBjYXQgLi90 ZXN0LmMNCiNpbmNsdWRlIDxzdGRpby5oPg0KDQppbnQgbWFpbih2b2lkKSB7 DQoJRklMRSAqZiA9IGZvcGVuKCJ0ZXN0LmJpbiIsICJ3Iik7DQoJaWYgKGYg PT0gTlVMTCkNCgkJcmV0dXJuIDE7DQoJZndyaXRlKCIxIiwgc2l6ZW9mICcx JywgMSwgZik7DQoJZmNsb3NlKGYpOw0KCXJldHVybiAwOw0KfQ0KJCBjbGFu ZyAuL3Rlc3QuYyAtbyB0ZXN0DQokIC4vdGVzdA0KJCBoZXhkdW1wIHRlc3Qu YmluDQowMDAwMDAwIDAwMzEgMDAwMA0KMDAwMDAwNA0KJCBjbGFuZysrIC4v dGVzdC5jIC1vIHRlc3QNCmNsYW5nLTMuOTogd2FybmluZzogdHJlYXRpbmcg J2MnIGlucHV0IGFzICdjKysnIHdoZW4gaW4gQysrIG1vZGUsIHRoaXMgDQpi ZWhhdmlvciBpcyBkZXByZWNhdGVkDQokIC4vdGVzdA0KJCBoZXhkdW1wIHRl c3QuYmluDQowMDAwMDAwIDAwMzENCjAwMDAwMDENCgotLSAKU2VudCB2aWEg cGdzcWwtaGFja2VycyBtYWlsaW5nIGxpc3QgKHBnc3FsLWhhY2tlcnNAcG9z dGdyZXNxbC5vcmcpClRvIG1ha2UgY2hhbmdlcyB0byB5b3VyIHN1YnNjcmlw dGlvbjoKaHR0cDovL3d3dy5wb3N0Z3Jlc3FsLm9yZy9tYWlscHJlZi9wZ3Nx bC1oYWNrZXJzCg== From pg@heroku.com Tue Aug 16 21:14:00 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZlgO-0002Q1-Bz for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 21:14:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZlgN-0000R1-Uh for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 21:13:59 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZlgN-0000Qv-E5 for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 21:13:59 +0000 Received: from mail-ua0-x232.google.com ([2607:f8b0:400c:c08::232]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZlgJ-0007OL-IU for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 21:13:58 +0000 Received: by mail-ua0-x232.google.com with SMTP id n59so142824513uan.2 for ; Tue, 16 Aug 2016 14:13:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heroku.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=PgM4gQsZ4PIkZOpS7/UUgig2gW6nkvW+MNAs0Mqiv8E=; b=rB2ypDsaN/jTP/KtpDhpT4mjYAaKmJjEW2vywtN5kEt6EvgMQPqTEGQgH2CHKXjLc3 HiHgqCUAQZGq6dUCAzML1oQ8N4QgofryDS+JuTRw0e166d20JUiHRZ1bOM31JTmWG0ze 5dl9yfOMjjQvv9GGXFp+oEQsMjXUHnnlwGwnpJ/Z6DmTi97bic4tSIS6pm6cuG8DxiFp ONPfbwHnOPLzllvas6ZJ6TrzgyBo/PwebzZUvB0PuyVSWl3XkPodfNNiTID77N5xVZjN hGS+MbrVBfUHB561obH4U/AnddKmAaQyfJ0Y0aHnV5+eQq50LIILg3NjXx+IzAYSIoHx gjAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=PgM4gQsZ4PIkZOpS7/UUgig2gW6nkvW+MNAs0Mqiv8E=; b=ibHDmm4Dx5hDRwZb3S9cywR2JzQMdil7bB7S6e7wnWsGt2stfnLJum93GlmDSvBJwb lOPUtRYuJ9mMNJg3hTbTJltG0y4yeUdkXomgOXNtPDxWRYKwfxEFrI1ixN92Kw9bZLle 4iRtFtxDWu9Zz70NVE9me+v4cQ49nadg5TTbxZfkhdfyw/DGbW9rWbGL4lZoHWbaRP5C xeeSKts78RIfPcp0Uuy55kO+cVXmYBdsAM1t3O5uQJiSiBJKShLycun5tPCxSaYP6NFy L011zxXlPpMx8QjIsuOBYlDai9v5zIPVVUkazcPYFs6Z2qSi8TqD+S3vBvW62ky/CrRv /WfA== X-Gm-Message-State: AEkoouvsqvXlXVt9bvRJSBA4lfAzaVIq6mZ8hPxuvmAC6QRw4n8lU6hYXvfOnXyX968bORcUtYS8xrvsNslDSmE4 X-Received: by 10.31.60.193 with SMTP id j184mr18178259vka.132.1471382034037; Tue, 16 Aug 2016 14:13:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.53.195 with HTTP; Tue, 16 Aug 2016 14:13:53 -0700 (PDT) In-Reply-To: <28200.1471381196@sss.pgh.pa.us> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <20160816205518.yesjo6w2t6os3kvu@alap3.anarazel.de> <28200.1471381196@sss.pgh.pa.us> From: Peter Geoghegan Date: Tue, 16 Aug 2016 14:13:53 -0700 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Tom Lane Cc: Andres Freund , Robert Haas , Jim Nasby , Gavin Flower , dandl , Adam Brusselback , Joy Arulraj , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Tue, Aug 16, 2016 at 1:59 PM, Tom Lane wrote: >> FWIW, IIRC that's not true for gcc/glibc, because they IIRC use common >> codepaths. But obviously that's not all-encompassing enough to rely on that. > > I wonder whether it'd be possible to implement the PG_TRY/CATCH macros > to use C++ exceptions when building in C++. This would probably mean > that C and C++ builds would be incompatible as far as loadable extensions > are concerned, because it'd amount to an ABI difference. But maybe > that's OK. We could certainly have the PG_MODULE_MAGIC macro guard > against the case. Maybe. I think that the best thing about C++ is the ability to encapsulate and simplify some aspects of resource management quite well, which necessitates reimplementing PG_TRY/CATCH. The worst thing about C++ is that ABI compatibility is far messier. This makes a C++ port seem less compelling to me than the idea first appears. Note, for example, that ICU is implemented in C++, but still has C stub functions, not necessarily for the exclusive benefit of C client code. -- Peter Geoghegan -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From andres@anarazel.de Tue Aug 16 21:15:23 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZlhj-0002YI-Hs for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 21:15:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZlhj-0001yo-3W for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 21:15:23 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZlhi-0001we-5m for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 21:15:22 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZlhf-0004Ia-Bi for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 21:15:20 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 6E1F320523; Tue, 16 Aug 2016 17:15:18 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Tue, 16 Aug 2016 17:15:18 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=RJJK5eYhGsWS0WT2QN8ob/aQrzs=; b=Y+0I/ tbS9g50YjLo8HTHL+kdRg/jyGQ79ciDTpz4awfQbPpb6j6QBUKf7EbOK0BOE2x6F M+S5B4VoFZt9GrX57WwrG3R9BaEFvu7KyzHrdACDfwmcDkV2r6xP2a2qqExFYfrA P1+aTKaXb1d0+qRHa+BynalBOP9ZzBDE948foY= X-Sasl-enc: gvtne6YLZk4Ql/KR3tyycPY7oYh+xN8TgJ2s8zBjjUsB 1471382118 Received: from intern.anarazel.de (somacentral1.static.monkeybrains.net [162.217.75.74]) by mail.messagingengine.com (Postfix) with ESMTPA id EDEE3F296E; Tue, 16 Aug 2016 17:15:17 -0400 (EDT) Date: Tue, 16 Aug 2016 14:15:16 -0700 From: Andres Freund To: Tom Lane Cc: Peter Geoghegan , Robert Haas , Jim Nasby , Gavin Flower , dandl , Adam Brusselback , Joy Arulraj , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut Subject: Re: [GENERAL] C++ port of Postgres Message-ID: <20160816211516.4y7je4oyhlhvq2ch@alap3.anarazel.de> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <20160816205518.yesjo6w2t6os3kvu@alap3.anarazel.de> <28200.1471381196@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <28200.1471381196@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2016-08-16 16:59:56 -0400, Tom Lane wrote: > Andres Freund writes: > > On 2016-08-16 13:40:06 -0700, Peter Geoghegan wrote: > >> Actually, come to think of it, I guess this is wrong. The problem with > >> what I say here is that longjmp() and setjmp() are incompatible with > >> the stack unwinding used by C++ destructors in general (exceptions are > >> another issue). I think that the practical implication of that is that > >> we can never use any C++ feature that hides the complexity of resource > >> management, unless and until elog() is reimplemented to not use > >> longjmp() and setjmp(). > > > FWIW, IIRC that's not true for gcc/glibc, because they IIRC use common > > codepaths. But obviously that's not all-encompassing enough to rely on that. > > I wonder whether it'd be possible to implement the PG_TRY/CATCH macros > to use C++ exceptions when building in C++. Yea, I suggested that somewhere nearby. I think that'd be fairly easy - to me the hard part is making it possible to compile postgres with C++, not changing the exception handling itself. > This would probably mean that C and C++ builds would be incompatible > as far as loadable extensions are concerned, because it'd amount to an > ABI difference. But maybe that's OK. We could certainly have the > PG_MODULE_MAGIC macro guard against the case. Right. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From cbbrowne@gmail.com Tue Aug 16 23:12:43 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZnXH-00005N-DR for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 23:12:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZnXG-0003mp-5Q for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Aug 2016 23:12:42 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZnXF-0003mi-7q for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 23:12:41 +0000 Received: from mail-yw0-x243.google.com ([2607:f8b0:4002:c05::243]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZnX7-0006NN-PE for pgsql-hackers@postgresql.org; Tue, 16 Aug 2016 23:12:39 +0000 Received: by mail-yw0-x243.google.com with SMTP id z8so4207226ywa.0 for ; Tue, 16 Aug 2016 16:12:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Ef7ebss25UZj43o1L+5SMFZCLGJ8SlfhHU1HgnZDKLI=; b=aTEDrgo/n4jlKOtqIMSmkYTr25JXv9n9uirU0Ip1w9/C4QFnDstHXybKOunMdiKB7U agEQJ84lL+yHDWcK5vG2KgM0mFDj+g/nW0TJhMoZE18gumFBWvV5h5drPRLj93nXo4fd MY3QqlSoSudF04KWq0OTEeegf0Lh+6BBoRm1AIr8gPcAsCPNfyT0x9g1FEhaToGJmh8h 66fje7It17Miw6SpC0rXVCUucs0pXNr8vZFp6a0azBoGDQFJ0Fqzn0rhybQz1/mdibyv KDVRJZeXYV+bvwwCTsjzs9bpq2KBGD7IRcKaX2WNCvpBUVIrCMRNwTzBSwgrbCpMOqXm OwVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Ef7ebss25UZj43o1L+5SMFZCLGJ8SlfhHU1HgnZDKLI=; b=TrZzBjOyEzWmDjW5iWR3BcURza6PAUSCKvdlNEBMav18pdk0wCsVSaFq9IauAYaolJ mtd29yykZo6JFGiFLMI3KfxEVt1de/tNOs0pJbM2nbS7n6KzYkGFyreVaM+d30aXrEHZ oFX8A2N/mi2Fzeb0aRCswDKOCd5IV7QZV/tgqYOUCMtcOaQ6FpAziHdzkTkhMH/19Uon P6B2YaIVpZDDJfaytOo+MUfhQOlhCa/51DJBRMzvdE5xwLjMqP6Pz+LC4sbkasyLlZA7 do2HOCClwtlUz1eXI73lgc524Cw5VWohGv3x1h6Fmrc4sffti3Yi2P0NcFs3e208/pjq DdmA== X-Gm-Message-State: AEkoousOrEtIgNDJC2O1hWBQ+ElSxeb60F0VXHK4SERsqY7wAS+Va+8pyATuU70cLltjjS5oQ1N94yXzRpOJHA== X-Received: by 10.13.217.136 with SMTP id b130mr25910037ywe.81.1471389152631; Tue, 16 Aug 2016 16:12:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.44.148 with HTTP; Tue, 16 Aug 2016 16:12:31 -0700 (PDT) In-Reply-To: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> From: Christopher Browne Date: Tue, 16 Aug 2016 19:12:31 -0400 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Piotr Stefaniak Cc: Robert Haas , Jim Nasby , Gavin Flower , dandl , Adam Brusselback , Joy Arulraj , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 16 August 2016 at 17:08, Piotr Stefaniak wrote: > On 2016-08-16 18:33, Robert Haas wrote: >> It wouldn't be that much work to maintain, either: we'd >> just set up some buildfarm members that compiled using C++ and when >> they turned red, we'd go fix it. > > I think that there exist subtle differences between C and C++ that > without compile-time diagnostic could potentially lead to different > run-time behavior. It seems to me that if we were really keen on attaching in another "totally compiled" language, that C++ wouldn't seem like the best choice. As you say, it's subtly different, which seems a bit dangerous to me. Further, it's not as if C++ is particularly newer than C. C is about 45 years old; C++, at 33, hardly seems like a "spry young whippersnapper" whose inclusion ought to lead to vast excitement. The would-be "spry young things" that head to my mind are Rust and Go. I'm not sure it's terribly plausible to have parts of Postgres written in both C and (Rust|Go); they're different enough that I'm not sure what functionality would mix sensibly. But I think that would be more interesting, all the same. Perhaps it would work out well to be able to create background workers in Rust, or to implement a stored procedure language in Go. -- When confronted by a difficult problem, solve it by reducing it to the question, "How would the Lone Ranger handle this?" -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From jarulraj@cs.cmu.edu Wed Aug 17 00:42:30 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZowA-0004Bq-CY for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 00:42:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZow9-0003jU-Vd for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 00:42:30 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZow8-0003fa-NG for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 00:42:28 +0000 Received: from smtp01.srv.cs.cmu.edu ([128.2.217.200]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZow4-0007pi-Jq for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 00:42:26 +0000 Received-SPF: none (cs.cmu.edu: No applicable sender policy available) receiver=smtp01.srv.cs.cmu.edu; identity=mailfrom; envelope-from="jarulraj@cs.cmu.edu"; helo=mail-ua0-f178.google.com; client-ip=209.85.217.178 Received: from mail-ua0-f178.google.com (mail-ua0-f178.google.com [209.85.217.178]) (authenticated bits=0) by smtp01.srv.cs.cmu.edu (8.13.6/8.13.6) with ESMTP id u7H0gKvP022247 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Tue, 16 Aug 2016 20:42:21 -0400 (EDT) Received: by mail-ua0-f178.google.com with SMTP id k90so149278501uak.1 for ; Tue, 16 Aug 2016 17:42:20 -0700 (PDT) X-Gm-Message-State: AEkoouteHB2m1UNnfiiBNhveAIMduo9xBZ8MvL43MFMsF3/dcYEKYeBjAkQhUNr1VDnRQOmnmGjuYTJtymd1zQ== X-Received: by 10.31.189.129 with SMTP id n123mr16944086vkf.134.1471394540079; Tue, 16 Aug 2016 17:42:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.159.38.70 with HTTP; Tue, 16 Aug 2016 17:41:59 -0700 (PDT) In-Reply-To: <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> From: Joy Arulraj Date: Tue, 16 Aug 2016 20:41:59 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Jim Nasby Cc: Robert Haas , Tom Lane , Gavin Flower , dandl , Adam Brusselback , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut Content-Type: multipart/alternative; boundary=94eb2c096c56e2d483053a39bc0d X-Scanned-By: mimedefang-cmuscs on 128.2.217.200 X-Pg-Spam-Score: -4.8 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --94eb2c096c56e2d483053a39bc0d Content-Type: text/plain; charset=UTF-8 On Tue, Aug 16, 2016 at 4:22 PM, Jim Nasby wrote: > On 8/16/16 12:53 PM, Joy Arulraj wrote: > >> > The whole thing would make a lot more sense given a credible design >> > for error handling that keeps both languages happy. >> >> Well, getting so that we can at least compile in both systems would >> certainly increase the chances of somebody being willing to work on >> such a design. And if nobody ever does, then at least people who want >> to fork and do research projects based on PostgreSQL will have >> slightly less work to do when they want to hack it up. PostgreSQL >> seems to be a very popular starting point for research work, but a >> paper I read recently complained about the antiquity of our code base. >> I prefer to call that backward-compatibility, but at some point people >> stop thinking of you as backward-compatible and instead think of you >> as simply backward. >> >> I agree, this was the main reason why we wanted to add support for C++. >> > > Joy, do you have an idea what a *minimally invasive* patch for C++ support > would look like? That's certainly the first step here. > > Jim -- I believe that the patch will be roughly 6K lines long. The majority of the changes correspond to handling language keyword conflicts. https://github.com/jarulraj/postgresql-cpp/compare/182656bf32b99c96e5cd9dc59ece4c20149787fb...7ef6f472b53a83a4cedd0222b41345c0f74fae1e I must mention that some of the changes I have made preclude the possibility of supporting compilation with both C and C++ compilers. However, I am certain that this limitation can be circumvented with some clever hacking. > -- > Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX > Experts in Analytics, Data Architecture and PostgreSQL > Data in Trouble? Get it in Treble! http://BlueTreble.com > 855-TREBLE2 (855-873-2532) mobile: 512-569-9461 > --94eb2c096c56e2d483053a39bc0d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Tue, Aug 16, 2016 at 4:22 PM, Jim Nasby <Jim.Na= sby@bluetreble.com> wrote:
On 8/16/16 12:53 PM, Joy Arulraj wrote:
=C2=A0 =C2=A0 > The whole thing would make a lot more sense given a cred= ible design
=C2=A0 =C2=A0 > for error handling that keeps both languages happy.

=C2=A0 =C2=A0 Well, getting so that we can at least compile in both systems= would
=C2=A0 =C2=A0 certainly increase the chances of somebody being willing to w= ork on
=C2=A0 =C2=A0 such a design.=C2=A0 And if nobody ever does, then at least p= eople who want
=C2=A0 =C2=A0 to fork and do research projects based on PostgreSQL will hav= e
=C2=A0 =C2=A0 slightly less work to do when they want to hack it up.=C2=A0 = PostgreSQL
=C2=A0 =C2=A0 seems to be a very popular starting point for research work, = but a
=C2=A0 =C2=A0 paper I read recently complained about the antiquity of our c= ode base.
=C2=A0 =C2=A0 I prefer to call that backward-compatibility, but at some poi= nt people
=C2=A0 =C2=A0 stop thinking of you as backward-compatible and instead think= of you
=C2=A0 =C2=A0 as simply backward.

I agree, this was the main reason why we wanted to add support for C++.

Joy, do you have an idea what a *minimally invasive* patch for C++ support = would look like? That's certainly the first step here.
<= div class=3D"h5">

Jim -- I = believe that the patch will be roughly 6K lines long. The majority of the c= hanges correspond to handling language keyword conflicts.
=
I must mention that some of the changes I have made preclude the possi= bility of supporting compilation with both C and C++ compilers. However, I = am certain that this limitation can be circumvented with some clever hackin= g.
=C2=A0
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)=C2=A0 =C2=A0mobile: 512-569-9461

--94eb2c096c56e2d483053a39bc0d-- From david@andl.org Wed Aug 17 00:42:18 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZovy-0004BT-Nf for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 00:42:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZovy-0003WF-Ac for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 00:42:18 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZovx-0003Vy-8T for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 00:42:17 +0000 Received: from sub4.mail.dreamhost.com ([69.163.253.135] helo=homiemail-a35.g.dreamhost.com) by makus.postgresql.org with esmtps (TLS1.1:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZovu-0007pc-FG for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 00:42:16 +0000 Received: from homiemail-a35.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a35.g.dreamhost.com (Postfix) with ESMTP id 9E7E9E00053E; Tue, 16 Aug 2016 17:44:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=andl.org; h=from:to:cc :references:in-reply-to:subject:date:message-id:mime-version :content-type:content-transfer-encoding; s=andl.org; bh=oqcP8tF5 ZYxivBHKvk/sAgzp63Q=; b=Ou53ZHL2jOZ2LMd7BxVTaFmpFGEeQNEBbCehjUeE Mf5Hv3r6Lq8IZ7P56gFni50zjxFpyXPC035vVLHiqOic9bQLgz94p0ySv7s9VKm6 4F/iFwVIOx2a018TZjG45CNnyZFA5PGDHNatm8fa9Q/C62N4XeOyj1cvxL59pcFQ iQk= Received: from Mona (pow1045804.lnk.telstra.net [120.150.90.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: david@andl.org) by homiemail-a35.g.dreamhost.com (Postfix) with ESMTPSA id D47E1E000536; Tue, 16 Aug 2016 17:44:07 -0700 (PDT) From: "dandl" To: "'Tom Lane'" Cc: "'Pg Hackers'" References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> In-Reply-To: Subject: Re: [GENERAL] C++ port of Postgres Date: Wed, 17 Aug 2016 10:45:25 +1000 Message-ID: <002401d1f820$a616f7a0$f244e6e0$@andl.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQHzYJ7/TjkBpUbQnt1f808SK2P68wIr5sjYAfRvnBIDesSd6ALW2B68ArliDJMCfcjNBgEeXKz7Af5zgMoCRHQ7bgJCz9FWAmg0X4ECMSVnTgHY/5bAnxuA7tA= Content-Language: en-au X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org > Well, getting so that we can at least compile in both systems would > certainly increase the chances of somebody being willing to work on > such a design.=20=20 From andres@anarazel.de Wed Aug 17 00:55:55 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZp99-0004ee-9A for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 00:55:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZp98-0001iC-Ik for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 00:55:54 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZp7l-0008Pj-HB for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 00:54:29 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZp7i-0002jK-2c for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 00:54:28 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 18D7E20501; Tue, 16 Aug 2016 20:54:24 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Tue, 16 Aug 2016 20:54:24 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=iohgorz5DLLOSa5baTVZM3Coe6o=; b=XcTSK P8/S9MNyM7hdld8JWyxBrmkpg6fXMMprRVTVqINolPFUgiRKoJrA4kIWJ6Q6hHtY qsAW4boQAK+U8hT2DwfBxTlUbwXYV1N0DwW2SJKeL3fyi77c/bxrUwSwLXRVYGp5 0RMsf+w917rAxwABzfx5unS78mhMnTWAYO63+4= X-Sasl-enc: QEq8NRY6jtDqehhWAyt6blOw0pCApWFHxqIh9wBKSF8Q 1471395263 Received: from intern.anarazel.de (somacentral1.static.monkeybrains.net [162.217.75.74]) by mail.messagingengine.com (Postfix) with ESMTPA id BC7A1F2983; Tue, 16 Aug 2016 20:54:23 -0400 (EDT) Date: Tue, 16 Aug 2016 17:54:22 -0700 From: Andres Freund To: dandl Cc: 'Tom Lane' , 'Pg Hackers' Subject: Re: [GENERAL] C++ port of Postgres Message-ID: <20160817005422.qjw7xvnbsbihqykv@alap3.anarazel.de> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <002401d1f820$a616f7a0$f244e6e0$@andl.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <002401d1f820$a616f7a0$f244e6e0$@andl.org> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2016-08-17 10:45:25 +1000, dandl wrote: > From my particular perspective it would be enough if all the internal > headers (that one needs to use in writing server-side extensions) were > completely usable in C++. That should already be the case. There's even a dirty hack^WWscript that checks that that remains the case (src/tools/pginclude/cpluspluscheck). -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From tsunakawa.takay@jp.fujitsu.com Wed Aug 17 01:17:55 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZpUR-0005Qd-P3 for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 01:17:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZpUQ-00075Q-Pq for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 01:17:54 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZpT1-0005Xz-Jb for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 01:16:27 +0000 Received: from mgwkm03.jp.fujitsu.com ([202.219.69.170]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZpSr-00037u-Up for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 01:16:26 +0000 Received: from kw-mxq.gw.nic.fujitsu.com (unknown [192.168.231.130]) by mgwkm03.jp.fujitsu.com with smtp id 51a1_6e7b_f1cc8d0b_65a5_4c05_ae92_dbef5002c208; Wed, 17 Aug 2016 10:16:06 +0900 Received: from g01jpfmpwyt03.exch.g01.fujitsu.local (g01jpfmpwyt03.exch.g01.fujitsu.local [10.128.193.57]) by kw-mxq.gw.nic.fujitsu.com (Postfix) with ESMTP id 01864AC0112 for ; Wed, 17 Aug 2016 10:16:06 +0900 (JST) Received: from G01JPEXCHYT16.g01.fujitsu.local (G01JPEXCHYT16.g01.fujitsu.local [10.128.194.55]) by g01jpfmpwyt03.exch.g01.fujitsu.local (Postfix) with ESMTP id 6838746E551; Wed, 17 Aug 2016 10:16:03 +0900 (JST) Received: from G01JPEXMBYT05.g01.fujitsu.local ([10.128.194.69]) by g01jpexchyt16 ([10.128.194.55]) with mapi id 14.03.0266.001; Wed, 17 Aug 2016 10:16:01 +0900 From: "Tsunakawa, Takayuki" To: Christopher Browne , Piotr Stefaniak CC: Robert Haas , Jim Nasby , Gavin Flower , dandl , "Adam Brusselback" , Joy Arulraj , kang joni , Dmitry Igrishin , "Pg Hackers" , Peter Eisentraut Subject: Re: [GENERAL] C++ port of Postgres Thread-Topic: [HACKERS] [GENERAL] C++ port of Postgres Thread-Index: AQHR9m/8k/ggKPK1GEOY5bL1G/A3gaBIY5mAgACg4/X//27MgIAAE38AgAHl1gCAAB1QgIAAGJ6AgAB0AgCAAB2XAIAATMcAgAAiqYCAALkaUA== Date: Wed, 17 Aug 2016 01:16:02 +0000 Message-ID: <0A3221C70F24FB45833433255569204D1F5C2668@G01JPEXMBYT05> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> In-Reply-To: Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: x-securitypolicycheck: OK by SHieldMailChecker v2.2.3 x-shieldmailcheckerpolicyversion: FJ-ISEC-20140219 x-originating-ip: [10.124.82.57] Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-SecurityPolicyCheck-GC: OK by FENCE-Mail X-TM-AS-MML: disable X-Pg-Spam-Score: -4.7 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org RnJvbTogcGdzcWwtaGFja2Vycy1vd25lckBwb3N0Z3Jlc3FsLm9yZw0KPiBb bWFpbHRvOnBnc3FsLWhhY2tlcnMtb3duZXJAcG9zdGdyZXNxbC5vcmddIE9u IEJlaGFsZiBPZiBQZXRlciBHZW9naGVnYW4NCj4gSSB0aGluayB0aGF0IHRo ZSBiZXN0IHRoaW5nIGFib3V0IEMrKyBpcyB0aGUgYWJpbGl0eSB0byBlbmNh cHN1bGF0ZSBhbmQNCj4gc2ltcGxpZnkgc29tZSBhc3BlY3RzIG9mIHJlc291 cmNlIG1hbmFnZW1lbnQgcXVpdGUgd2VsbCwgd2hpY2ggbmVjZXNzaXRhdGVz DQo+IHJlaW1wbGVtZW50aW5nIFBHX1RSWS9DQVRDSC4gVGhlIHdvcnN0IHRo aW5nIGFib3V0IEMrKyBpcyB0aGF0IEFCSQ0KPiBjb21wYXRpYmlsaXR5IGlz IGZhciBtZXNzaWVyLiBUaGlzIG1ha2VzIGEgQysrIHBvcnQgc2VlbSBsZXNz IGNvbXBlbGxpbmcNCj4gdG8gbWUgdGhhbiB0aGUgaWRlYSBmaXJzdCBhcHBl YXJzLg0KDQpGcm9tOiBwZ3NxbC1oYWNrZXJzLW93bmVyQHBvc3RncmVzcWwu b3JnDQo+IFttYWlsdG86cGdzcWwtaGFja2Vycy1vd25lckBwb3N0Z3Jlc3Fs Lm9yZ10gT24gQmVoYWxmIE9mIENocmlzdG9waGVyDQo+IEZ1cnRoZXIsIGl0 J3Mgbm90IGFzIGlmIEMrKyBpcyBwYXJ0aWN1bGFybHkgbmV3ZXIgdGhhbiBD LiAgQyBpcyBhYm91dCA0NQ0KPiB5ZWFycyBvbGQ7IEMrKywgYXQgMzMsIGhh cmRseSBzZWVtcyBsaWtlIGEgInNwcnkgeW91bmcgd2hpcHBlcnNuYXBwZXIi DQo+IHdob3NlIGluY2x1c2lvbiBvdWdodCB0byBsZWFkIHRvIHZhc3QgZXhj aXRlbWVudC4NCj4NCj4gVGhlIHdvdWxkLWJlICJzcHJ5IHlvdW5nIHRoaW5n cyIgdGhhdCBoZWFkIHRvIG15IG1pbmQgYXJlIFJ1c3QgYW5kIEdvLiAgSSdt DQo+IG5vdCBzdXJlIGl0J3MgdGVycmlibHkgcGxhdXNpYmxlIHRvIGhhdmUg cGFydHMgb2YgUG9zdGdyZXMgd3JpdHRlbiBpbiBib3RoDQo+IEMgYW5kIChS dXN0fEdvKTsgdGhleSdyZSBkaWZmZXJlbnQgZW5vdWdoIHRoYXQgSSdtIG5v dCBzdXJlIHdoYXQNCj4gZnVuY3Rpb25hbGl0eSB3b3VsZCBtaXggc2Vuc2li bHkuICBCdXQgSSB0aGluayB0aGF0IHdvdWxkIGJlIG1vcmUNCj4gaW50ZXJl c3RpbmcsIGFsbCB0aGUgc2FtZS4gIFBlcmhhcHMgaXQgd291bGQgd29yayBv dXQgd2VsbCB0byBiZSBhYmxlIHRvDQo+IGNyZWF0ZSBiYWNrZ3JvdW5kIHdv cmtlcnMgaW4gUnVzdCwgb3IgdG8gaW1wbGVtZW50IGEgc3RvcmVkIHByb2Nl ZHVyZQ0KPiBsYW5ndWFnZSBpbiBHby4NCg0KDQpGaXJzdCwgSSdtIG5laXRo ZXIgZm9yIG5vciBhZ2FpbnN0IHJld3JpdGluZyBQb3N0Z3JlU1FMIGluIEMr Ky4gIEJ1dCBJIHdvbmRlciB3aGV0aGVyIGl0IHdvdWxkIHJlYWxseSBwYXkg Zm9yIHRoZSBjb3N0LiAgSSdtIHdvcnJpZWQgYWJvdXQgdGhlc2UsIGZvciBl eGFtcGxlOg0KDQoqIFdvdWxkbid0IGl0IGluY3JlYXNlIHRoZSBjb2Rpbmcg YW5kIHRlc3RpbmcgYnVyZG9uPyAgQ29kaW5nIGFuZCB0ZXN0aW5nIGluIEMs IGFuZCBjb2RpbmcgYW5kIHRlc3RpbmcgaW4gQysrLiAgUG9zdGdyZVNRTCBz ZWVtIHRvIGhhdmUgbWFueSBmZWF0dXJlcyB0byBkZXZlbG9wLCBhbmQgSSdt IG5vdCBzdXJlIEMrKyB3aWxsIGhlbHAgdG8gc3BlZWQgdXAgdGhlIGRldmVs b3BtZW50IG9mIHRoZW0uDQoNCiogV291bGQgaXQgcmVhbGx5IGF0dHJhY3Qg bW9yZSBkZXZlbG9wZXJzIG9mIFBvc3RncmVTUUwgaXRzZWxmLCBub3QgZXh0 ZW5zaW9ucz8gIEZZSSwgVGlvYmUgSW5kZXggc2F5cyBDIGlzIG5lYXJseSB0 d2ljZSBhcyBwb3B1bGFyIGFzIEMrKy4NCg0KaHR0cDovL3d3dy50aW9iZS5j b20vdGlvYmUtaW5kZXgvDQoNCiogV291bGRuJ3QgaXQgZGlzdGFuY2Ugc29t ZSBkZXZlbG9wZXJzIGlmIHRoZXkgZG9uJ3Qgd2FudCB0byBsZWFybiBDKys/ ICBBcyBDaHJpc3RvcGhlciBzYWlkLCBDKysgaXMgb2xkIGFuZCB0aGVyZSBh cmUgbWFueSBuZXdlciBsYW5ndWFnZXMgdGhhdCBhdHRyYWN0IGRldmVsb3Bl cnMgLS0gQyMsIFN3aWZ0LCBHbywgSmF2YSwgSmF2YVNjcmlwdCwgZXRjLiAg SSB3b25kZXIgd2hldGhlciByZWNlbnQgZGV2ZWxvcGVycyB3YW50IHRvIHNw ZW5kIHRpbWUgaW4gbGVhcm5pbmcgY29tcGxleCBDKysgbm93LiAgSSBsZWFy bmVkIEMrKyBiZWNhdXNlIGl0IGlzIHN0aWxsIHRoZSBtb3N0IHBvcHVsYXIg bGFuZ3VhZ2UgaW4gZ2FtZSBkZXZlbG9wbWVudCwgYnV0IG1heWJlIEkgd291 bGQgbm90IHdhbnQgdG8gbGVhcm4gQysrIGFueW1vcmUgaWYgSSBkaWRuJ3Qg a25vdyBDKysuDQoNClJlZ2FyZHMNClRha2F5dWtpIFRzdW5ha2F3YQ0KDQoN CgotLSAKU2VudCB2aWEgcGdzcWwtaGFja2VycyBtYWlsaW5nIGxpc3QgKHBn c3FsLWhhY2tlcnNAcG9zdGdyZXNxbC5vcmcpClRvIG1ha2UgY2hhbmdlcyB0 byB5b3VyIHN1YnNjcmlwdGlvbjoKaHR0cDovL3d3dy5wb3N0Z3Jlc3FsLm9y Zy9tYWlscHJlZi9wZ3NxbC1oYWNrZXJzCg== From andres@anarazel.de Wed Aug 17 01:49:53 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZpzN-0006aA-QY for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 01:49:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZpzN-0007LT-D4 for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 01:49:53 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZpzL-0007Jv-IO for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 01:49:51 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZpzH-0003dU-Uj for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 01:49:51 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id A7CFA201A7; Tue, 16 Aug 2016 21:49:46 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Tue, 16 Aug 2016 21:49:46 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=gAk/jAwxnC/1A4TdEX6afwXRqvk=; b=uwu4w jYqQTJQiZFBKYlQOjxjV3IH7tBYjXLhByUb3+0X4DT/Fe3K6VU0FUQx3g5UeXMkp 3cTKPTOI5CZCxEKnrjgLlNeyKjNRsSl9M2JoYRSLN2DEm8anwa2ggD9QDQ/ttI+U xEVvKQHAjcxvRC0qzLOgn/zHzaL/6R7tinsTMw= X-Sasl-enc: q/KliQuMZEpxD3kYsgtxESpKgR8NXh51THLglvO7Zqdj 1471398586 Received: from intern.anarazel.de (somacentral1.static.monkeybrains.net [162.217.75.74]) by mail.messagingengine.com (Postfix) with ESMTPA id 4F30DF2970; Tue, 16 Aug 2016 21:49:46 -0400 (EDT) Date: Tue, 16 Aug 2016 18:49:44 -0700 From: 'Andres Freund' To: dandl Cc: 'Tom Lane' , 'Pg Hackers' Subject: Re: [GENERAL] C++ port of Postgres Message-ID: <20160817014944.hkfd46ipmj4rh76y@alap3.anarazel.de> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <002401d1f820$a616f7a0$f244e6e0$@andl.org> <20160817005422.qjw7xvnbsbihqykv@alap3.anarazel.de> <003701d1f829$d2308dc0$7691a940$@andl.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <003701d1f829$d2308dc0$7691a940$@andl.org> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2016-08-17 11:51:04 +1000, dandl wrote: > > > From my particular perspective it would be enough if all the > > internal > > > headers (that one needs to use in writing server-side extensions) > > were > > > completely usable in C++. > > > > That should already be the case. There's even a dirty hack^WWscript > > that checks that that remains the case > > (src/tools/pginclude/cpluspluscheck). > > The source code for my project is here: > https://github.com/davidandl/Andl/tree/master/plandl > https://github.com/davidandl/Andl/blob/master/plandl/plandl.c > > I was not able to get this file to compile correctly in C++, and my > recollection is that at the time I asked on this list and that was the > advice. You need to include the files surrounded by extern "C" { }. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From david@andl.org Wed Aug 17 01:49:35 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZpz5-0006ZT-8E for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 01:49:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZpz4-0007HH-1Z for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 01:49:34 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZpxb-0005fq-7c for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 01:48:03 +0000 Received: from sub4.mail.dreamhost.com ([69.163.253.135] helo=homiemail-a66.g.dreamhost.com) by magus.postgresql.org with esmtps (TLS1.1:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZpxT-0003dE-55 for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 01:48:02 +0000 Received: from homiemail-a66.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a66.g.dreamhost.com (Postfix) with ESMTP id 917EEB004286; Tue, 16 Aug 2016 18:47:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=andl.org; h=from:to:cc :references:in-reply-to:subject:date:message-id:mime-version :content-type:content-transfer-encoding; s=andl.org; bh=AdKnUH8H U+IrXJhHnDV8WJyuft4=; b=I3e1ESXh+PdxdkkvKtD+ayrYDvZ93SLIKWLdnnZn DfCVJY5Wi8obn2Lgl5qtFv01ruWVujHdgIQZaM6k+z8E+X3mGZZOrPAZBjGQU6Ah bUe+YbD6f3uCaSwr5pSbN9ZBuV95OKbY96TMARVkVT8JV616gYi2z8bH7LO6MmqH RAI= Received: from Mona (pow1045804.lnk.telstra.net [120.150.90.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: david@andl.org) by homiemail-a66.g.dreamhost.com (Postfix) with ESMTPSA id 908C4B004282; Tue, 16 Aug 2016 18:47:50 -0700 (PDT) From: "dandl" To: "'Andres Freund'" Cc: "'Tom Lane'" , "'Pg Hackers'" References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <002401d1f820$a616f7a0$f244e6e0$@andl.org> <20160817005422.qjw7xvnbsbihqykv@alap3.anarazel.de> In-Reply-To: <20160817005422.qjw7xvnbsbihqykv@alap3.anarazel.de> Subject: Re: [GENERAL] C++ port of Postgres Date: Wed, 17 Aug 2016 11:51:04 +1000 Message-ID: <003701d1f829$d2308dc0$7691a940$@andl.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQK5YgyTtHInWrN+IWITFHXkqB0Y/wJ9yM0GAR5crPsB/nOAygJEdDtuAkLP0VYCaDRfgQIxJWdOAdj/lsACfRcoZAHsaZKondWfTsA= Content-Language: en-au X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org > > From my particular perspective it would be enough if all the > internal > > headers (that one needs to use in writing server-side extensions) > were > > completely usable in C++. > > That should already be the case. There's even a dirty hack^WWscript > that checks that that remains the case > (src/tools/pginclude/cpluspluscheck). The source code for my project is here: https://github.com/davidandl/Andl/tree/master/plandl https://github.com/davidandl/Andl/blob/master/plandl/plandl.c I was not able to get this file to compile correctly in C++, and my recollection is that at the time I asked on this list and that was the advice. Sorry, I don't remember the error but it seemed to be too deeply embedded to worry about. I just wrote the C code and moved on. Since the Windows COM in the other part is C++ only, I finished up with a mixed build. It works fine, but is not the ideal outcome. Regards David M Bennett FACS Andl - A New Database Language - andl.org -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From craig@2ndquadrant.com Wed Aug 17 05:18:00 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZtEl-0005vn-U5 for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 05:18:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZtEk-0006C5-F8 for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 05:17:58 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZtDM-0004gV-3w for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 05:16:32 +0000 Received: from mail-ua0-x233.google.com ([2607:f8b0:400c:c08::233]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bZtDH-00076K-Nk for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 05:16:31 +0000 Received: by mail-ua0-x233.google.com with SMTP id k90so156257062uak.1 for ; Tue, 16 Aug 2016 22:16:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=aNsMTePtFoOvEzbFJ6I50Hn+RcuzDyQbRF6ydV9ZzJQ=; b=ck2TrRAqaQHmoep2AENhD44YUyrcouwLmMgkCf2RdosLrs2e/Xuhu3zphYGLdlJ6US YP0gdNO0dFGNqj3URIorjzyViLfXKzKTeJ2Ly7jsdTWXjmLSpv3llVbVCvhBv/lmzdVI qo7v2esgU8hLzWXrg8QFC1zW/Fsvlsg9tMUyWwnUh05+Ua2/tgRTg/QCKZmrf7QDHhy3 MRYNOw6C9XU+AaUt38rwa2G8w5KCwNhmlQEETGtwkiInJZ0R80zpwS7R8VF4DOT7qJtc 1RLmZl/nAjiWI8z1DlI7fFLXU/c5EIrnl+gXkAzSIzAUPeU/rl8BnUFHMKUpSBMpeFw7 ypgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=aNsMTePtFoOvEzbFJ6I50Hn+RcuzDyQbRF6ydV9ZzJQ=; b=hnikC9V/qMHzBiM3gfF7jqI9w4aO6vNxA1WXYnFQtnTKKic/qxvHxAVbB1L+guPUy1 XwOpRNlAR5qhC4oq339BQZfEWsxJz86L0JxKe2fD8xhPM+CZCdLrURwkmUgDygfGRUkB HIEat5/bz+qifjWbWToEd/2rp7dMhQB/Vf623AdeIeaNwRTODxJFDBvMpDzuF9yvKVWE 05/Ee9FQISAlN5SIfhuJUmo8NaUr2a3rQ1jqlJC08jqm/ZRhV9puj2MglrjLieQfGuyk ogAzLpD+THDy8hEY1QQcCQTbUPCaUgJrbMWwh7wpi7K914QRoN1/QZeMdHfzCkhTtO2i U6SQ== X-Gm-Message-State: AEkooutKpnSQKWSBZz3/6yoEyWwR0WcPdvJPUIA8mmu+pNtcah3G4w18ECICyBXOW5qCJFIG2AN1s56IQ26ZeQ5j X-Received: by 10.31.156.136 with SMTP id f130mr18851777vke.45.1471410985649; Tue, 16 Aug 2016 22:16:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.5.66 with HTTP; Tue, 16 Aug 2016 22:16:24 -0700 (PDT) In-Reply-To: <20160817014944.hkfd46ipmj4rh76y@alap3.anarazel.de> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <002401d1f820$a616f7a0$f244e6e0$@andl.org> <20160817005422.qjw7xvnbsbihqykv@alap3.anarazel.de> <003701d1f829$d2308dc0$7691a940$@andl.org> <20160817014944.hkfd46ipmj4rh76y@alap3.anarazel.de> From: Craig Ringer Date: Wed, 17 Aug 2016 13:16:24 +0800 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Andres Freund Cc: dandl , Tom Lane , Pg Hackers Content-Type: multipart/alternative; boundary=001a1140f58c1e975a053a3d9121 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --001a1140f58c1e975a053a3d9121 Content-Type: text/plain; charset=UTF-8 On 17 August 2016 at 09:49, Andres Freund wrote: > > You need to include the files surrounded by extern "C" { }. > I'd really like to adopt the convention used by many libraries etc of doing this automatically - detecting a c++ compiler in the preprocessor and wrapping in "extern "C"" . Having the codebase c++-clean enough to compile with a c++ compiler seems to be the easiest way to maintain that, but means more "extern "C"" droppings in the .c files, not just the headers. Still, pretty ignoreable. -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services --001a1140f58c1e975a053a3d9121 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On 1= 7 August 2016 at 09:49, Andres Freund <andres@anarazel.de> = wrote:
=C2=A0

You need to include the files surrounded by extern "C" { }= .

I'd really like to adopt the convention used by many li= braries etc of doing this automatically - detecting a c++ compiler in the p= reprocessor and wrapping in "extern "C"" .
Having the codebase c++-clean enough to compile with a c++ com= piler seems to be the easiest way to maintain that, but means more "ex= tern "C"" droppings in the .c files, not just the headers. S= till, pretty ignoreable.

--
=C2=A0Craig Ringer=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 http://www.2ndQuadrant.com/=
=C2=A0PostgreSQL Development, 24x7 Support, Training & Services
=
--001a1140f58c1e975a053a3d9121-- From a.alekseev@postgrespro.ru Wed Aug 17 10:03:29 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZxh2-0004KR-Te for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 10:03:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZxh2-0007Al-ED for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 10:03:28 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZxh1-0007A0-0x for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 10:03:27 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZxgw-0003Tp-Ht for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 10:03:26 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 3130921C02EA; Wed, 17 Aug 2016 13:03:22 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NAxZYDZzyBYF; Wed, 17 Aug 2016 13:03:22 +0300 (MSK) Received: from e733 (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id 0280C21C02DC; Wed, 17 Aug 2016 13:03:22 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1471428202; bh=EdbTGz0XM9ZOk/9+gvbtMSfrtZ3bqhBRr5ktsGHNM90=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=dClkjYa5udJd3xDBROTtb/D5iIiJmh4pboc+mUj06BQwTzS6CDiOIeMplkfXkvHxj ht7PRqyJ5WtAjZl2aTCxDUygyVorwb6nNZ0SwjK8NI/FILOCdF6LFWeYaDU0LyHStg bTzyp8HW8Yl5GWK+Cd/emIOJB61+mBnlHLd/r9EM= Date: Wed, 17 Aug 2016 13:02:08 +0300 From: Aleksander Alekseev To: Yury Zhuravlev Cc: Subject: Re: [GENERAL] C++ port of Postgres Message-ID: <20160817130208.1490fad8@e733> In-Reply-To: <9b5d3b02-d9bb-42d2-9519-c4569f2964eb@postgrespro.ru> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <20160816183940.4818d854@e733> <9b5d3b02-d9bb-42d2-9519-c4569f2964eb@postgrespro.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org > Two big projects lately move to C++ from C: > GCC, Mesa > > You can read their reasons. > Only C++ we can use without full rewrite currently. (or ObjectC maybe) > If we wish fix C limitations. > I would like just to leave this link here: https://en.wikipedia.org/wiki/List_of_fallacies Long story short - no one cares who did what in other projects. Recently I rewrote my OpenGL demo [1] from C++ to C. Uber recently moved from PostgreSQL to MySQL. It proves literally nothing. [1] https://github.com/afiskon/c-opengl-text/ -- Best regards, Aleksander Alekseev -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From a.alekseev@postgrespro.ru Wed Aug 17 11:43:14 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZzFZ-0003SV-Nj for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 11:43:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bZzFZ-0007oI-1q for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 11:43:13 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bZzEB-0006I2-1B for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 11:41:47 +0000 Received: from newmail.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZzE6-0005BO-Nm for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 11:41:46 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id F35E921C0504; Wed, 17 Aug 2016 14:41:40 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Received: from mail.postgrespro.ru ([127.0.0.1]) by localhost (mail.postgrespro.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Jx4BajYq1koQ; Wed, 17 Aug 2016 14:41:40 +0300 (MSK) Received: from e733 (unknown [192.168.27.1]) by mail.postgrespro.ru (Postfix) with ESMTPSA id B604121C04ED; Wed, 17 Aug 2016 14:41:40 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1471434100; bh=/zcogZgn5ZKN+nEmrS7O0gW/DRAuvFCIUG9WaD1M3G0=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=OSAM1TnPaMGi0HMm+Fw/UJmjmlkqb6M9+mJjNB4a5GVtWzHZMYGcQxb30gT78xw03 tTlTLSGaXL+fJNVHawm46dGfedsMi1qpHiq8MyUl96vaJrwxmq1dVHRtKXj2S/Kfv1 IVTOtsPBtggur17Qm6ZMn1JZ7mac4KEVdpxpBlQo= Date: Wed, 17 Aug 2016 14:40:27 +0300 From: Aleksander Alekseev To: Jim Nasby Cc: Gavin Flower , dandl , 'Adam Brusselback' , 'Joy Arulraj' , 'kang joni' , 'Dmitry Igrishin' , Pg Hackers , Peter Eisentraut Subject: Re: [GENERAL] C++ port of Postgres Message-ID: <20160817144027.36b71351@e733> In-Reply-To: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <20160816183940.4818d854@e733> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org > I'm sure this wasn't your intent, but the tone of your response is > part of why people don't get involved with Postgres development... > > Please note that you're the only person in the entire thread that's > said anything to the effect of a holy war... > > OTOH, if the community takes the stance of "WTF WHY DO WE NEED > THIS?!", we've just driven Joy and anyone else that's a C++ fan away. I'm sorry for being maybe to emotional. It's was not (and never is!) my intent to offend anyone. Also I would like to note that I don't speak for community, I speak for myself. What I saw was: "hey, lets rewrite PostgreSQL in C++ without any good reason except (see [1] list)". Naturally I though (and still think) that you people are just trolls. Or maybe "everything should be written in C++ because it's the only right language and anyone who thinks otherwise is wrong" type of fanatics. Thus I don't think you are here to help. Give a concrete reason. Like "hey, we rewrote this part of code in C++ and look, its much more readable, twice as fast as code in C (how to do benchmarks right is a separate good topic!) and it still compiles fast even on Raspberry Pi, works on all platforms you are supporting, etc". Or "hey, we solved xid wraparound problem once and for all, but solution is in C++, so its for you to decide whether to merge it or not". If you really want to help, just solve _real_ problems using instruments you prefer instead of reposting obviously holly war topic from general@ mailing list. [1] https://en.wikipedia.org/wiki/List_of_fallacies -- Best regards, Aleksander Alekseev -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From srielau@gmail.com Wed Aug 17 14:18:46 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ba1g6-0005Zk-69 for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 14:18:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ba1g5-0005uL-E5 for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 14:18:45 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ba1Vc-0005Lf-PC for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 14:07:56 +0000 Received: from mail-pa0-x232.google.com ([2607:f8b0:400e:c03::232]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1ba1VY-0007fB-2h for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 14:07:55 +0000 Received: by mail-pa0-x232.google.com with SMTP id pp5so36778473pac.3 for ; Wed, 17 Aug 2016 07:07:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc:message-id:references :to; bh=LJQdw98rBLAFeMGbMiFzFI3fU12swcxS8IV7g3L4j5w=; b=QZL/sA4tDZVC7LhmzWi/6VF18CYOtWOnx7ngN3J5i9xODxSRChiOF/h6+e3zyVFU1f dQGwez610skqBEmDJVs6gr3gjq8qXfbwwjRdgXeHU+TPMvx0rjSAWUbziacFxCUirFoh GQUOTD7QFqpYLNDC816P9cOxK+6gYjHCVdrpCu3ZkXjijt0gyBa9XoPMrT6fGc0l11kd ZiHDIOuAzjM1JHjYWJ6F/HghwUF1G/t0aqvs1W2nbsUsHJEVjuyYML5JQDaTSN2WTeqM oA3M1j4/t2yffC9eos/yHpvfBqwY+dUNN7YpaeCoSX9wBGIFsy6tdw9ywVKusd1xh1S+ s8Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=LJQdw98rBLAFeMGbMiFzFI3fU12swcxS8IV7g3L4j5w=; b=bnLV4xsCae/gBvXij8bRFsqaWSNIjZikd5P8BirBqGtP1KhLgUbh4m16J2fRzqNnuG Wu+5INT6gjSTCjeJ0knTUMFP9FdLF30gvvHtIS34UneteVfZ9ArNaDGqPr9O/0T4Cwqm DpNn34Jwxi27W0yQujhPJiYqIiaoTjUhVYAXpefjnlq7TKI2NIIUDdp0mgjS7umQjx1n 2kozKBJG6vrd0MBd8Hq8S0g3u4ddsk9yuh+s1UhMUOoA4AxuTuAMNz9SrOfD2oLjUVUf QvN32FDlUxK+L7Cr38p9xB+RbSSrzK/5tF5qN1BL35hAomEwrKiuDHPJi+QjIQxtZHA5 H+Aw== X-Gm-Message-State: AEkoout/dIdFXSMS+PoDK3vgi9ASM+8wS07yhvsyzr9CczXiuaesJY/f30/ZWIaSYvuMrw== X-Received: by 10.66.20.166 with SMTP id o6mr74658259pae.96.1471442869301; Wed, 17 Aug 2016 07:07:49 -0700 (PDT) Received: from srielau-ltm.internal.salesforce.com ([204.14.239.106]) by smtp.gmail.com with ESMTPSA id u1sm47675390pfu.12.2016.08.17.07.07.48 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Aug 2016 07:07:48 -0700 (PDT) Content-Type: multipart/alternative; boundary="Apple-Mail=_B35C1A59-4D70-48BE-A45A-2800A7DE51CE" Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: [GENERAL] C++ port of Postgres From: Serge Rielau In-Reply-To: Date: Wed, 17 Aug 2016 07:07:49 -0700 Cc: Andres Freund , dandl , Tom Lane , Pg Hackers Message-Id: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <002401d1f820$a616f7a0$f244e6e0$@andl.org> <20160817005422.qjw7xvnbsbihqykv@alap3.anarazel.de> <003701d1f829$d2308dc0$7691a940$@andl.org> <20160817014944.hkfd46ipmj4rh76y@alap3.anarazel.de> To: Craig Ringer X-Mailer: Apple Mail (2.3124) X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --Apple-Mail=_B35C1A59-4D70-48BE-A45A-2800A7DE51CE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Aug 16, 2016, at 10:16 PM, Craig Ringer = wrote: >=20 > On 17 August 2016 at 09:49, Andres Freund > wrote: > =20 >=20 > You need to include the files surrounded by extern "C" { }. >=20 > I'd really like to adopt the convention used by many libraries etc of = doing this automatically - detecting a c++ compiler in the preprocessor = and wrapping in "extern "C"" . >=20 > Having the codebase c++-clean enough to compile with a c++ compiler = seems to be the easiest way to maintain that, but means more "extern = "C"" droppings in the .c files, not just the headers. Still, pretty = ignoreable. >=20 Big +1 here, Just having community code compilable with a C++ compiler out of the box = would go a long way. Beyond that, on my end I have been working with PG now for a year and a = half and here is a quick list of what I sorely miss from my C++ days: * Overloading of functions (same as in SQL) keeps naming clean * Named parameters (same as SQL) keeps code readable * Adding new function parameters with defaults so I don=E2=80=99t need = to pass in NULL, 0, =E2=80=A6 at 20 places (again supported in SQL) * Member functions greatly help organize code * simple inheritance (as emulated today in node types) At my old employer we used C++ for the DBMS in various degrees in = different components. That degree was agreed upon in coding standards, so we could pick what = we like about C++ and blacklist what we didn=E2=80=99t. E.g. C style exception handling was prohibited Default memory management (new) was prohibited. Instead new() was overloaded and hooked into the DBMS memory manager. I see no reason why this couldn=E2=80=99t be done in PG. I can=E2=80=99t comment of compiling on a Rasperry PI, but know that my = former DBMS code compiled and ran on Windows, Linux, AIX, Sun, HP, and = Mac. But again, just having the community code compile so proprietary (for = now) enhancements could be written in C++ would be huge. Cheers Serge =20= --Apple-Mail=_B35C1A59-4D70-48BE-A45A-2800A7DE51CE Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On Aug 16, 2016, at 10:16 PM, Craig Ringer <craig@2ndquadrant.com> wrote:

On 17 = August 2016 at 09:49, Andres Freund <andres@anarazel.de> wrote:
 

You need to include the files surrounded by extern "C" { }.

I'd really like to adopt the convention = used by many libraries etc of doing this automatically - detecting a c++ = compiler in the preprocessor and wrapping in "extern "C"" .

Having the codebase = c++-clean enough to compile with a c++ compiler seems to be the easiest = way to maintain that, but means more "extern "C"" droppings in the .c = files, not just the headers. Still, pretty ignoreable.

Big +1 here,
Just having = community code compilable with a C++ compiler out of the box would go a = long way.

Beyond = that, on my end I have been working with PG now for a year and a half = and here is a quick list of what I sorely miss from my C++ = days:
* Overloading of functions (same as in SQL) = keeps naming clean
* Named parameters (same as SQL) = keeps code readable
* Adding new function = parameters with defaults so I don=E2=80=99t need to pass in NULL, 0, =E2=80= =A6 at 20 places (again supported in SQL)
* Member = functions greatly help organize code
* simple = inheritance (as emulated today in node types)

At my old employer we used C++ for the = DBMS in various degrees in different components.
That= degree was agreed upon in coding standards, so we could pick what we = like about C++ and blacklist what we didn=E2=80=99t.
E.g. C style exception handling was prohibited
Default memory management (new) was prohibited.
Instead new() was overloaded and hooked into the DBMS memory = manager.
I see no reason why this couldn=E2=80=99t = be done in PG.

I= can=E2=80=99t comment of compiling on a Rasperry PI, but know that my = former DBMS code compiled and ran on Windows, Linux, AIX, Sun, HP, and = Mac.

But = again, just having the community code compile so proprietary (for now) = enhancements could be written in C++ would be huge.


Cheers
Serge
  
= --Apple-Mail=_B35C1A59-4D70-48BE-A45A-2800A7DE51CE-- From dmitigr@gmail.com Wed Aug 17 15:02:24 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ba2MK-0007ok-IO for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 15:02:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ba2MK-0006qT-3G for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 15:02:24 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ba2Kw-0005Jx-7z for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 15:00:58 +0000 Received: from mail-it0-x231.google.com ([2607:f8b0:4001:c0b::231]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1ba2Ks-0000Ao-TV for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 15:00:57 +0000 Received: by mail-it0-x231.google.com with SMTP id x131so1904873ite.0 for ; Wed, 17 Aug 2016 08:00:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=n6lXRfrVfndaLzIyWTYQ1JewbOyfFZkmwRZliNzfupo=; b=bxybVBZbzkyv7lwlCnDbUsb+ow+A/dA2/uutC62eewqIIYai7I9Xu1c07lES7ztmeq 9VdHzGk8pJ72mXHDV13VLBW/qpvXaiLPDyXn/OL9AShZZqOZHrHMgGkmdw+9n5Odeze9 zBTt5Y1SxkLsb2kZD5RRclikfApvim2JyEuEbGEG/uUCQlizjQEmKzaczzHmJ1ZrDV0W f0e1edAADK9vP+ONMtTxnSoRictben+tPNkWnS6DWlbtPuV83ir3k4n9c2luq9k1sS4F GtC9SzdkKIjyM4ejAzi9lMblwoJqZdSx5oXy8ZIgp1ZLZ7uWGuTkDdoF4QFMYC8t2kDT 4gJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=n6lXRfrVfndaLzIyWTYQ1JewbOyfFZkmwRZliNzfupo=; b=UgoTZaQyp62VbGx/M4TkC1aeIRA3V34CYTbkxaxBcqV8p2KnXD0EcXqgtrcoS3jgQG O1J/8tRWe0/B+6DNrjPmT/6wLJTPsMVcH6gdO+l4aJO0y87+3UCU1x/OT59diJ6BsDen h8+Y4g31VfxjwaK05jbjkKcc+jH6V8cza8mKsBW7UPMv4SJax+9u8dmaBCbEUrOLPJU+ 33w/KGVOTEtkogTTtVUcxefagACpHNliylV43vvMhWhmCqOETOLfswOU912Q6sJNfmMQ b0wCYINyQ7pLvlWH9R254SzTmfyLsw7Mu8YaMPuAbACBD9Frp1Zj78/pa479j9quI2T2 7Avw== X-Gm-Message-State: AEkooutOYrd/xoJkEPYaQfcxdULn5N256sX3/d/j/oapIIZjd2jTcLG+1O6KMTrA9ed44+1NRm7zVy8BX1au4A== X-Received: by 10.36.152.5 with SMTP id n5mr27567515itd.79.1471446052691; Wed, 17 Aug 2016 08:00:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.38.70 with HTTP; Wed, 17 Aug 2016 08:00:51 -0700 (PDT) In-Reply-To: <20160817144027.36b71351@e733> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <20160816183940.4818d854@e733> <20160817144027.36b71351@e733> From: Dmitry Igrishin Date: Wed, 17 Aug 2016 18:00:51 +0300 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Aleksander Alekseev Cc: Jim Nasby , Gavin Flower , dandl , Adam Brusselback , Joy Arulraj , kang joni , Pg Hackers , Peter Eisentraut Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 2016-08-17 14:40 GMT+03:00 Aleksander Alekseev : >> I'm sure this wasn't your intent, but the tone of your response is >> part of why people don't get involved with Postgres development... >> >> Please note that you're the only person in the entire thread that's >> said anything to the effect of a holy war... >> >> OTOH, if the community takes the stance of "WTF WHY DO WE NEED >> THIS?!", we've just driven Joy and anyone else that's a C++ fan away. > > I'm sorry for being maybe to emotional. It's was not (and never is!) my > intent to offend anyone. Also I would like to note that I don't speak > for community, I speak for myself. > > What I saw was: "hey, lets rewrite PostgreSQL in C++ without any good > reason except (see [1] list)". Naturally I though (and still think) that > you people are just trolls. Or maybe "everything should be written in > C++ because it's the only right language and anyone who thinks > otherwise is wrong" type of fanatics. Thus I don't think you are here to > help. > > Give a concrete reason. Like "hey, we rewrote this part of code in C++ > and look, its much more readable, twice as fast as code in C (how to do > benchmarks right is a separate good topic!) and it still compiles fast > even on Raspberry Pi, works on all platforms you are supporting, etc". > Or "hey, we solved xid wraparound problem once and for all, but solution > is in C++, so its for you to decide whether to merge it or not". I doubt that someone will rush to rewrite PostgreSQL in C++. At now, the reason to consider the refactoring of current codebase to make the C++ compilers happy, is to make the code more qualitative. I think, that only after that step it is reasonable to consider the use some of C++ features. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From robertmhaas@gmail.com Wed Aug 17 15:20:56 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ba2eG-0000V8-1X for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 15:20:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ba2eF-00006R-Jf for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 15:20:55 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ba2eD-00004w-C9 for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 15:20:53 +0000 Received: from mail-qk0-x236.google.com ([2607:f8b0:400d:c09::236]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1ba2e9-0000WU-AX for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 15:20:52 +0000 Received: by mail-qk0-x236.google.com with SMTP id t7so21408444qkh.1 for ; Wed, 17 Aug 2016 08:20:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=KmNIh7C3vpH2LZjw2u9WbPTI5jpv/INCPAOhd49FiVs=; b=x6QBrkus8vsE6ngn0O7tCE2Yh1yC07kESBOVPMRRdxdql28tVPz6oeTMooRoootqQq dYDqohZEnfNLku/JmBczM9jhyul10IaP8qyu86KiUP0enoZiDjM2i35ByVuQDPGKGj3I 0rJ+IwkUIeaorAG3yoOgMFvxhnjEpEgWML4LKm+/MefZXoZ6ycrhO05ifvXEWYpzc5jl cJq9D7il6g13bxqkf8UB2RG/95xpWjHOvjSVMMru+g1b50T2LnKJxnRWt3eygR9puBxR hYYcQyMgSHdyv4nYnCq4/BK8rZuH++HX7UF/WHmhBckg5PAEsKu/WvJXZTpsRWYSZ9A3 1k/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=KmNIh7C3vpH2LZjw2u9WbPTI5jpv/INCPAOhd49FiVs=; b=T1r/kOke8157c0C8fmCbyT/TCQASkvXFRHXkJm7UtimDkMHskik76DC5sBVEmARMxp KfQtKhvlUSg8TOjbQA2uJG0EVmj8+UfINjSNqpkvFFy7c6Fh6t8xWR4MaYwuXihupllh lxxQ46gvMEAyMkkgocXSAXYMTqCejQtXFdrkWlDpcoNog3P9NVBJ9HGmQv2QeLevyzHV BzzLxU5JX7/BFlfROd833tzn/Nmfr2zlGBckbx4o+Z8l/cpmR7ZwNq75N9XyaScgdIg0 eyzRjyWXNI8RtuWzVunaohhHM1dXegmiDyf1uSUhwfv1Lg+2hZ/6JzdIe2p0miqAAG5Z jc1Q== X-Gm-Message-State: AEkoouuw/7e998PIii9S5dMpjuWindJcMmijWTAPe7o67ATBDf6KXz3o6kOfT6SaN9/cqNgLqJjr1lHEyItjmQ== X-Received: by 10.55.188.195 with SMTP id m186mr44024335qkf.180.1471447247791; Wed, 17 Aug 2016 08:20:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.49.75 with HTTP; Wed, 17 Aug 2016 08:20:46 -0700 (PDT) In-Reply-To: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> From: Robert Haas Date: Wed, 17 Aug 2016 11:20:46 -0400 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Piotr Stefaniak Cc: Jim Nasby , Gavin Flower , dandl , Adam Brusselback , Joy Arulraj , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Tue, Aug 16, 2016 at 5:08 PM, Piotr Stefaniak wrote: > On 2016-08-16 18:33, Robert Haas wrote: >> It wouldn't be that much work to maintain, either: we'd >> just set up some buildfarm members that compiled using C++ and when >> they turned red, we'd go fix it. > > I think that there exist subtle differences between C and C++ that > without compile-time diagnostic could potentially lead to different > run-time behavior. As an artificial example: > > $ cat ./test.c > #include > > int main(void) { > FILE *f = fopen("test.bin", "w"); > if (f == NULL) > return 1; > fwrite("1", sizeof '1', 1, f); > fclose(f); > return 0; > } > $ clang ./test.c -o test > $ ./test > $ hexdump test.bin > 0000000 0031 0000 > 0000004 > $ clang++ ./test.c -o test > clang-3.9: warning: treating 'c' input as 'c++' when in C++ mode, this > behavior is deprecated > $ ./test > $ hexdump test.bin > 0000000 0031 > 0000001 Hmm, so sizeof() has different semantics in C vs. C++? While that's a little alarming, I'm wondering whether this sort of thing is likely to actually be a problem in practice. We have such a long laundry list of coding conventions already that I am inclined to believe we could add a few more without breaking our ability to do development. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From andrew@tao11.riddles.org.uk Wed Aug 17 15:37:43 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ba2uV-0001iR-9D for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 15:37:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ba2uT-0008Po-N0 for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 15:37:41 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ba2t5-0006rS-Nh for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 15:36:15 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1ba2t2-0005wM-CM for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 15:36:14 +0000 Received: from localhost ([127.0.0.1]:44570 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtp (Exim 4.84 (FreeBSD)) (envelope-from ) id 1ba2sv-0004s8-2r; Wed, 17 Aug 2016 15:36:05 +0000 From: Andrew Gierth To: Robert Haas Cc: Piotr Stefaniak , Jim Nasby , Gavin Flower , dandl , Adam Brusselback , Joy Arulraj , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut Subject: Re: [GENERAL] C++ port of Postgres In-Reply-To: (Robert Haas's message of "Wed, 17 Aug 2016 11:20:46 -0400") Message-ID: <87a8gbjtxr.fsf@news-spur.riddles.org.uk> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) Date: Wed, 17 Aug 2016 16:36:05 +0100 MIME-Version: 1.0 Content-Type: text/plain X-Pg-Spam-Score: -2.4 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org >>>>> "Robert" == Robert Haas writes: Robert> Hmm, so sizeof() has different semantics in C vs. C++? No. '1' has different semantics in C vs C++. (In C, '1' is an int, whereas in C++ it's a char. It so happens that (sizeof '1') is the only case which is valid in both C and C++ where this makes a difference.) -- Andrew (irc:RhodiumToad) -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From robertmhaas@gmail.com Wed Aug 17 16:21:16 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ba3ae-0004v2-Jx for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 16:21:16 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ba3ad-0000Op-R0 for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 16:21:15 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ba3ab-0000Jv-6q for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 16:21:13 +0000 Received: from mail-qk0-x22e.google.com ([2607:f8b0:400d:c09::22e]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1ba3aT-0001WE-8S for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 16:21:12 +0000 Received: by mail-qk0-x22e.google.com with SMTP id v123so104615777qkh.2 for ; Wed, 17 Aug 2016 09:21:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=NU2ks/CahFSAlGmkji0SicDTb391mCV0aoqxRLomEuA=; b=rlt+4DvlnSMw5+Y2DyXfVv8asvtKiQ4xkKVv0cfhNwawVTiM1oIJZJlHNqXAJqWckb sTmE/gf0Nz00SbaF6RFWz3ykvHCr8uXg8/8zDL21c4k7l9PoW8uNuhSikUgxv9W5GKLf GENeb0rZKR2jlb6MxrA7zhvOox9ASkIer9bYZ1oNSjYWyWW+mcyVnzOVwBiJziEK0Wfe EgTOy2DoPPglU44OrOmJwyCFRY8CYqltr2Pq+gblKAWqBU/DXsr+Ya7NhOyKBQ04J6BN IFkIw0kXlWGhtmjwndVGTMtj7qDHDltXuOXIPwPYq8JbCoajxunv/r8Euw4q1kAmL6x6 juww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=NU2ks/CahFSAlGmkji0SicDTb391mCV0aoqxRLomEuA=; b=fKLxKU86YtSvNqvdzRuxCO2W2ZboThLOUYNHLuFRKmnJqYrFqxH538/tEHGxAg/ZbB jOwwEUegTaUJ1Lmq+6XafpvypcC2xmrS7Feo0Q5TqoEeNNtttfXgI8P+oRsp4jijARG1 tz9AQdrZVAZLmK6UheuvmdTaOo8e9TGxXxoNgIfd34hXSCDhPgrqFwnv1q75PdYhF9q8 vmSBv6C1kFbz5u7YqNtkfSgqdTJ9HJDF1b3j+rIvjmVJmKqpzzBWpmRtA3lIrvnu6Xcd LYh9i9N9A8CK/TIEnc3OsRG/zG/eBuptHs66bbOqkYPubU2bSOpvPqNPRii7V1qK52LX 8p4A== X-Gm-Message-State: AEkooutjFET51BoV+J5xk7IlbYhMq2pUfQdRSpDeCwZ4CmqLjyXo0maE0qOd23ZduB4MXgr/wSdOmgeTCm5JsA== X-Received: by 10.55.16.218 with SMTP id 87mr48800788qkq.220.1471450863812; Wed, 17 Aug 2016 09:21:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.49.75 with HTTP; Wed, 17 Aug 2016 09:21:03 -0700 (PDT) In-Reply-To: <87a8gbjtxr.fsf@news-spur.riddles.org.uk> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <87a8gbjtxr.fsf@news-spur.riddles.org.uk> From: Robert Haas Date: Wed, 17 Aug 2016 12:21:03 -0400 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Andrew Gierth Cc: Piotr Stefaniak , Jim Nasby , Gavin Flower , dandl , Adam Brusselback , Joy Arulraj , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Wed, Aug 17, 2016 at 11:36 AM, Andrew Gierth wrote: >>>>>> "Robert" == Robert Haas writes: > > Robert> Hmm, so sizeof() has different semantics in C vs. C++? > > No. '1' has different semantics in C vs C++. (In C, '1' is an int, > whereas in C++ it's a char. It so happens that (sizeof '1') is the only > case which is valid in both C and C++ where this makes a difference.) OK. Doesn't seem like a big problem. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From GavinFlower@archidevsys.co.nz Wed Aug 17 18:15:40 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ba5NM-0004Ty-2E for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 18:15:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ba5NL-0004wp-C3 for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 18:15:39 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ba5NI-0004vq-Te for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 18:15:36 +0000 Received: from mbx.knossos.net.nz ([202.160.48.10]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ba5N8-0003V3-Q3 for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 18:15:35 +0000 Received: from [192.168.20.2] (default-rdns.callplus.co.nz [121.99.202.67] (may be forged)) (authenticated bits=0) by mbx.knossos.net.nz (8.14.4/8.14.4) with ESMTP id u7HIEfJG015201 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Thu, 18 Aug 2016 06:14:42 +1200 Subject: Re: [GENERAL] C++ port of Postgres To: Aleksander Alekseev , Jim Nasby References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <20160816183940.4818d854@e733> <20160817144027.36b71351@e733> Cc: dandl , "'Adam Brusselback'" , "'Joy Arulraj'" , "'kang joni'" , "'Dmitry Igrishin'" , Pg Hackers , Peter Eisentraut From: Gavin Flower Organization: ArchiDevSys Message-ID: <955bbf6e-2731-57fb-4271-35b8363c43f2@archidevsys.co.nz> Date: Thu, 18 Aug 2016 06:14:40 +1200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160817144027.36b71351@e733> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 17/08/16 23:40, Aleksander Alekseev wrote: >> I'm sure this wasn't your intent, but the tone of your response is >> part of why people don't get involved with Postgres development... >> >> Please note that you're the only person in the entire thread that's >> said anything to the effect of a holy war... >> >> OTOH, if the community takes the stance of "WTF WHY DO WE NEED >> THIS?!", we've just driven Joy and anyone else that's a C++ fan away. > I'm sorry for being maybe to emotional. It's was not (and never is!) my > intent to offend anyone. Also I would like to note that I don't speak > for community, I speak for myself. > > What I saw was: "hey, lets rewrite PostgreSQL in C++ without any good > reason except (see [1] list)". Naturally I though (and still think) that > you people are just trolls. Or maybe "everything should be written in > C++ because it's the only right language and anyone who thinks > otherwise is wrong" type of fanatics. Thus I don't think you are here to > help. > > Give a concrete reason. Like "hey, we rewrote this part of code in C++ > and look, its much more readable, twice as fast as code in C (how to do > benchmarks right is a separate good topic!) and it still compiles fast > even on Raspberry Pi, works on all platforms you are supporting, etc". > Or "hey, we solved xid wraparound problem once and for all, but solution > is in C++, so its for you to decide whether to merge it or not". > > If you really want to help, just solve _real_ problems using instruments > you prefer instead of reposting obviously holly war topic from general@ > mailing list. > > [1] https://en.wikipedia.org/wiki/List_of_fallacies > My main language is Java, and there are a lot of very good reasons for rewriting Postgres in Java, but I'd never push that - as there are also many good reasons for NOT rewriting Postgres in Java! I am not an expert in C++, but I'm interested in its development and growing usage. I've read enough about C++ to think it worthwhile to consider rewriting Postgres in C++. If I had time, I would get deeper into C++, but for now pressures push me towards getting deeper into JavaScript - despite having an intense dislike for JavaScript! The first 2 languages I used commercially were FORTRAN & COBOL back in the 70's, and I've been paid to teacht C to experienced programmers. As far as I am concerned, there is no one language that is perfect. I have written programs i over 20 different languages. So I did not suggest C++, because I'm a C++ Fanatic!!! Cheers, Gavin -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From craig@2ndquadrant.com Wed Aug 17 23:32:33 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1baAK1-0000k7-Kh for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 23:32:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1baAK0-0008Eh-BH for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 23:32:32 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1baAJz-0008Dr-3T for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 23:32:31 +0000 Received: from mail-ua0-x22b.google.com ([2607:f8b0:400c:c08::22b]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1baAJu-0000JM-VZ for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 23:32:30 +0000 Received: by mail-ua0-x22b.google.com with SMTP id 97so4224862uav.3 for ; Wed, 17 Aug 2016 16:32:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=AwCthLRGMVE4p3Fr9wJWvPGI8K/rMVEFyG5lM1TbBEE=; b=yF7dS/ekNO4jJmLFfNkg/9LrAZw2/IsDugIUMSnh7FQ6D8TEYYUR1qZFwLf1/MZVxY ckLYV0e8tByjlm2Qgdt6VJWWsjvqK+qCR+weQSG9X3mfFOJretIdBiBlWR9szPBEmvCf JTxMT7J4t2xHKVgfta82cxirHk297iNSQaCZ3E4tvwURLlZcWBG4EtjklY9feklG/jEy ioTN4P0XJSFkyqI8FAMEeJlAaScIah/9c3jaJW3B+Y/x/ZHsQVc3Y74YSYoRKRtsQ2eq GiCDjLVkZ54iGO69CkwOIJcpqWbZDixBZqZMVEVUZ6NYRfv71W3XjTl6F2ckCNrbOazg SwSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=AwCthLRGMVE4p3Fr9wJWvPGI8K/rMVEFyG5lM1TbBEE=; b=OSt1yvqEYzY3rfaM5ohb2TRGusEU63FKFjeOFBSUDkFCmyyWfuM7MLOK7ILjl6Esxw iEotWSKJ5AMkJzfVgdlgr4lWMcSk1q9HuNV6pHTv8EEz32WFy8aDy/VmBtsRKdV8Gqla qroqas8DPMoGXOcnfZgACXWEx4lU3N3wBdkiQxfD+eUeH60yXoW09zbOtL3xBnW/fHyn TLl/a4bdym62Ip8oDxGq/BhUpXhPldpRUWOztDvI5M/KrMA1cnG1ZQMrXzMvek+wnQwO 8Qj4l1l0lHoffINw3/xkIxxPr1WSIkuaO6lVdAdS3vcwt9SkzUxr9hQgs5MvBZEfc4Yb WhpQ== X-Gm-Message-State: AEkoousEimA68VACEl6xSKmmK7i0Y6RsdJFM43SW02CvxHr3GjPmqfgMEuHIsP8dVi+ni8Sdvcl8DA++rug1yKcb X-Received: by 10.31.156.136 with SMTP id f130mr21242146vke.45.1471476745041; Wed, 17 Aug 2016 16:32:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.5.66 with HTTP; Wed, 17 Aug 2016 16:32:23 -0700 (PDT) In-Reply-To: <955bbf6e-2731-57fb-4271-35b8363c43f2@archidevsys.co.nz> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <20160816183940.4818d854@e733> <20160817144027.36b71351@e733> <955bbf6e-2731-57fb-4271-35b8363c43f2@archidevsys.co.nz> From: Craig Ringer Date: Thu, 18 Aug 2016 07:32:23 +0800 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Gavin Flower Cc: Aleksander Alekseev , Jim Nasby , dandl , Adam Brusselback , Joy Arulraj , kang joni , Dmitry Igrishin , Pg Hackers , Peter Eisentraut Content-Type: multipart/alternative; boundary=001a1140f58caf15ff053a4ce035 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --001a1140f58caf15ff053a4ce035 Content-Type: text/plain; charset=UTF-8 On 18 August 2016 at 02:14, Gavin Flower wrote: > My main language is Java, and there are a lot of very good reasons for > rewriting Postgres in Java, but I'd never push that - as there are also > many good reasons for NOT rewriting Postgres in Java! > I don't know why folks are jumping on the idea of a "rewrite". The original post mentioned a C++ port, adding C++ compatibility and adopting some C++ features. Hardly a rewrite. I'm not convinced that's a good idea either, unless it shows compelling advantages in code clarity, performance, static checking, etc. But it's hardly a "rewrite", that's just hyperbolic. I think that to get anywhere with this you'll need to show a more concrete plan for: * What happens with libpq * How this affects existing extensions and what changes they'll need * How this affects PGXS * What benefits this change offers. Concrete benefits with examples - performance numbers, code snippets, etc * Compatibility impact on platform and compiler support Since there's approximately zero chance of a "one big commit" switchover, you'll also need to present a transition plan, probably something like: * Make all headers "extern "C"" conditionally if compiled as C++ * Add "extern "C"" to all C files conditionally if compiled as C++ * add a 'configure' option to compile as C++ * Progressively resolve C++-incompatibilities in C files and headers until the whole database compiles as c++ * Resolve any runtime issues * Add buildfarm client support for optionally building with c++ * Switch one or more buildfarm members to build with c++ or add new ones * Identify and fix compatibility issues on other platforms Then down the track we'd: * Switch to C++ builds by default * Define a C++ coding standard/policy that strictly identifies what C++ features are permissible * Shut down the C-only buildfarm members and start permitting some C++ feature use where appropriate -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services --001a1140f58caf15ff053a4ce035 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On 1= 8 August 2016 at 02:14, Gavin Flower <GavinFlower@archidevsys.= co.nz> wrote:
=C2=A0
My main language is Java, and there are a lot of very good reasons for rewr= iting Postgres in Java, but I'd never push that - as there are also man= y good reasons for NOT rewriting Postgres in Java!
I don't know why folks are jumping on the idea of a "r= ewrite". The original post mentioned a C++ port, adding C++ compatibil= ity and adopting some C++ features. Hardly a rewrite.

<= div>I'm not convinced that's a good idea either, unless it shows co= mpelling advantages in code clarity, performance, static checking, etc. But= it's hardly a "rewrite", that's just hyperbolic.

I think that to get anywhere with this you'll need to= show a more concrete plan for:

* What happens wit= h libpq
* How this affects existing extensions and what changes t= hey'll need
* How this affects PGXS
* What benefits= this change offers. Concrete benefits with examples - performance numbers,= code snippets, etc
* Compatibility impact on platform and compil= er support

Since there's approximately zero ch= ance of a "one big commit" switchover, you'll also need to pr= esent a transition plan, probably something like:

= * Make all headers "extern "C"" conditionally if compil= ed as C++
* Add "extern "C"" to all C files c= onditionally if compiled as C++
* add a 'configure' optio= n to compile as C++
* Progressively resolve C++-incompatibilities= in C files and headers until the whole database compiles as c++
= * Resolve any runtime issues
* Add buildfarm client support for o= ptionally building with c++
* Switch one or more buildfarm member= s to build with c++ or add new ones
* Identify and fix compatibil= ity issues on other platforms

Then down the track = we'd:
* Switch to C++ builds by default
* Define a = C++ coding standard/policy that strictly identifies what C++ features are p= ermissible
* Shut down the C-only buildfarm members and start per= mitting some C++ feature use where appropriate


--
=C2=A0Craig Ringer=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 http://www.2ndQuadrant.com/
=C2=A0PostgreSQL Development= , 24x7 Support, Training & Services
--001a1140f58caf15ff053a4ce035-- From peter.eisentraut@2ndquadrant.com Wed Aug 31 15:11:39 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bf7Aw-0002ch-SC for pgsql-hackers@arkaria.postgresql.org; Wed, 31 Aug 2016 15:11:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bf7Av-0000i7-Jb for pgsql-hackers@arkaria.postgresql.org; Wed, 31 Aug 2016 15:11:37 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bf5lm-0006wt-Av for pgsql-hackers@postgresql.org; Wed, 31 Aug 2016 13:41:34 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bf5lg-00065h-F1 for pgsql-hackers@postgresql.org; Wed, 31 Aug 2016 13:41:33 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id D48D8207A0; Wed, 31 Aug 2016 09:41:27 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute2.internal (MEProxy); Wed, 31 Aug 2016 09:41:27 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=hW1UqtoXSRo934Q6n1PhF9xtdXQ=; b=mVV6m xeWD6hl9hVB/O0AHBoiZhCzspmjXtzAhDQ6iobISfSFEvhAe5IdPWsp6H+DzELaA KXSk9S01SqOfhDemVy8BAtNMACxoave9TzNrYt8T8iVOrtMAvLTX5FDsLa6XxUCe flWsd90GpFH+QRyH5vUjq+UMiIEnmIlQ36zL40= X-Sasl-enc: UUlvCCs6wqcaoM4tm7Ri6oNR1h+bw/hJKq9Dem8riRU1 1472650887 Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id 191D7F29CD; Wed, 31 Aug 2016 09:41:27 -0400 (EDT) Subject: Re: [GENERAL] C++ port of Postgres References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> Cc: Jim Nasby To: Pg Hackers From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: Date: Wed, 31 Aug 2016 09:41:26 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> Content-Type: multipart/mixed; boundary="------------F26294506435CC8013AB58CF" X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org This is a multi-part message in MIME format. --------------F26294506435CC8013AB58CF Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit [trimmed cc list because of big attachments] On 8/16/16 4:22 PM, Jim Nasby wrote: > Joy, do you have an idea what a *minimally invasive* patch for C++ > support would look like? That's certainly the first step here. I developed a minimally invasive patch for C++ support a few years ago shortly after I wrote that blog post. Since there appears to have been some interest here now, I have updated that and split it up into logical chunks. So here you go. To build this, you need to configure with g++ <= version 5. (4.x works, too.) g++ version 6 does not work yet because of the issues described in patch 0013. Then you also need to edit src/Makefile.custom and set COPT = -fpermissive -Wno-sign-compare -Wno-write-strings The -W options are optional just to reduce some noise. Cleaning up those warnings can be a separate project that might also have some benefit under C. The -fpermissive option is a g++ specific option that reduces some errors to warnings. (So this won't work with clang or other compilers at all at this point.) In particular, C++ does not allow casting from or to void pointers without a cast, but -fpermissive allows that. The step from this to "real" C++ would be adding a bunch of casts around things like malloc and palloc and other places. That would be mostly busy work, so I have excluded that here. The patches are numbered approximately in increasing order of dubiosity. So 0001 is probably a straight bug fix, 0002 and 0003 are arguably minor bug fixes as well. The patches through 0012 can probably be considered for committing in some form. After that it gets a bit hackish. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0001-Fix-use-of-offsetof.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-Fix-use-of-offsetof.patch" =46rom 86dbd4a5a0ab3212cd340e1fa56f03e864aa8e1a Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 01/27] Fix use of offsetof() Using offsetof() with a run-time computed argument is not allowed in either C or C++. Apparently, gcc allows it, but g++ doesn't. --- contrib/bloom/blutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/bloom/blutils.c b/contrib/bloom/blutils.c index debf4f4..b68a0d1 100644 --- a/contrib/bloom/blutils.c +++ b/contrib/bloom/blutils.c @@ -75,7 +75,7 @@ _PG_init(void) bl_relopt_tab[i + 1].optname =3D MemoryContextStrdup(TopMemoryContext, buf); bl_relopt_tab[i + 1].opttype =3D RELOPT_TYPE_INT; - bl_relopt_tab[i + 1].offset =3D offsetof(BloomOptions, bitSize[i]); + bl_relopt_tab[i + 1].offset =3D offsetof(BloomOptions, bitSize[0]) + siz= eof(int) * i; } } =20 --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0002-Use-return-instead-of-exit-in-configure.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0002-Use-return-instead-of-exit-in-configure.patch" =46rom d3c7c1fbb346fd5c040a7a379d971db7b5129581 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 02/27] Use return instead of exit() in configure Using exit() requires stdlib.h, which is not included. Use return instead. Also add return type for main(). --- config/c-compiler.m4 | 4 +++- config/c-library.m4 | 4 +++- configure | 12 +++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 index a7f6773..7d901e1 100644 --- a/config/c-compiler.m4 +++ b/config/c-compiler.m4 @@ -71,8 +71,10 @@ int does_int64_work() return 0; return 1; } + +int main() { - exit(! does_int64_work()); + return (! does_int64_work()); }])], [Ac_cachevar=3Dyes], [Ac_cachevar=3Dno], diff --git a/config/c-library.m4 b/config/c-library.m4 index 50d068d..56658b5 100644 --- a/config/c-library.m4 +++ b/config/c-library.m4 @@ -204,8 +204,10 @@ int does_int64_snprintf_work() return 0; /* either multiply or snprintf is busted */ return 1; } + +int main() { - exit(! does_int64_snprintf_work()); + return (! does_int64_snprintf_work()); }]])], [pgac_cv_snprintf_long_long_int_modifier=3D$pgac_modifier; break], [], diff --git a/configure b/configure index 45c8eef..36d9a54 100755 --- a/configure +++ b/configure @@ -13563,8 +13563,10 @@ int does_int64_work() return 0; return 1; } + +int main() { - exit(! does_int64_work()); + return (! does_int64_work()); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : @@ -13645,8 +13647,10 @@ int does_int64_work() return 0; return 1; } + +int main() { - exit(! does_int64_work()); + return (! does_int64_work()); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : @@ -13739,8 +13743,10 @@ int does_int64_snprintf_work() return 0; /* either multiply or snprintf is busted */ return 1; } + +int main() { - exit(! does_int64_snprintf_work()); + return (! does_int64_snprintf_work()); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0003-Add-missing-include-files-to-configure-tests.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0003-Add-missing-include-files-to-configure-tests.patch" =46rom 54ed07be5a29d4955a9485316e68da5c6896797b Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 03/27] Add missing include files to configure tests atoi() needs stdlib.h strcmp() needs string.h --- config/c-library.m4 | 4 +++- configure | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config/c-library.m4 b/config/c-library.m4 index 56658b5..8a9da36 100644 --- a/config/c-library.m4 +++ b/config/c-library.m4 @@ -42,7 +42,8 @@ if test "$ac_cv_member_struct_tm_tm_zone" =3D yes; then fi AC_CACHE_CHECK(for tzname, ac_cv_var_tzname, [AC_LINK_IFELSE([AC_LANG_PROGRAM( -[[#include +[[#include +#include #ifndef tzname /* For SGI. */ extern char *tzname[]; /* RS6000 and others reject char **tzname. */ #endif @@ -184,6 +185,7 @@ AC_DEFUN([PGAC_FUNC_SNPRINTF_LONG_LONG_INT_MODIFIER], AC_CACHE_VAL(pgac_cv_snprintf_long_long_int_modifier, [for pgac_modifier in 'll' 'q' 'I64'; do AC_RUN_IFELSE([AC_LANG_SOURCE([[#include +#include typedef long long int ac_int64; #define INT64_FORMAT "%${pgac_modifier}d" =20 diff --git a/configure b/configure index 36d9a54..2308c61 100755 --- a/configure +++ b/configure @@ -11538,6 +11538,7 @@ if ${ac_cv_var_tzname+:} false; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include #include #ifndef tzname /* For SGI. */ extern char *tzname[]; /* RS6000 and others reject char **tzname. */ @@ -13723,6 +13724,7 @@ else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include +#include typedef long long int ac_int64; #define INT64_FORMAT "%${pgac_modifier}d" =20 --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0004-Fix-LDFLAGS-test-for-C.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0004-Fix-LDFLAGS-test-for-C.patch" =46rom ee7e69813784e7cf120165ba222e93f91d0d8f42 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 04/27] Fix LDFLAGS test for C++ The test looks to link to particular function, so we need to make that function have C linkage. --- config/c-compiler.m4 | 9 ++++++++- configure | 27 ++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 index 7d901e1..21fb464 100644 --- a/config/c-compiler.m4 +++ b/config/c-compiler.m4 @@ -353,7 +353,14 @@ AC_DEFUN([PGAC_PROG_CC_LDFLAGS_OPT], AC_CACHE_CHECK([whether $CC supports $1], [Ac_cachevar], [pgac_save_LDFLAGS=3D$LDFLAGS LDFLAGS=3D"$pgac_save_LDFLAGS $1" -AC_RUN_IFELSE([AC_LANG_PROGRAM([extern void $2 (); void (*fptr) () =3D $2;= ],[])], +AC_RUN_IFELSE([AC_LANG_PROGRAM([#ifdef __cplusplus +extern "C" { +#endif +extern void $2 (); +#ifdef __cplusplus +} +#endif +void (*fptr) () =3D $2;],[])], [Ac_cachevar=3Dyes], [Ac_cachevar=3Dno], [Ac_cachevar=3D"assuming no"]) diff --git a/configure b/configure index 2308c61..d74b25f 100755 --- a/configure +++ b/configure @@ -15748,7 +15748,14 @@ if test "$cross_compiling" =3D yes; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern void $link_test_func (); void (*fptr) () =3D $link_test_func; +#ifdef __cplusplus +extern "C" { +#endif +extern void $link_test_func (); +#ifdef __cplusplus +} +#endif +void (*fptr) () =3D $link_test_func; int main () { @@ -15787,7 +15794,14 @@ if test "$cross_compiling" =3D yes; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern void $link_test_func (); void (*fptr) () =3D $link_test_func; +#ifdef __cplusplus +extern "C" { +#endif +extern void $link_test_func (); +#ifdef __cplusplus +} +#endif +void (*fptr) () =3D $link_test_func; int main () { @@ -15826,7 +15840,14 @@ if test "$cross_compiling" =3D yes; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern void $link_test_func (); void (*fptr) () =3D $link_test_func; +#ifdef __cplusplus +extern "C" { +#endif +extern void $link_test_func (); +#ifdef __cplusplus +} +#endif +void (*fptr) () =3D $link_test_func; int main () { --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0005-Add-test-for-Wmissing-prototypes.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0005-Add-test-for-Wmissing-prototypes.patch" =46rom 98b10d21551df4d038e10287f9bb447922897342 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 05/27] Add test for -Wmissing-prototypes This was part of the hard-coded default warnings set in C, but the option is not valid for C++ (since prototypes are always required). --- configure | 38 +++++++++++++++++++++++++++++++++++++- configure.in | 4 +++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/configure b/configure index d74b25f..7821c2f 100755 --- a/configure +++ b/configure @@ -4418,7 +4418,43 @@ fi # but has its own. Also check other compiler-specific flags here. =20 if test "$GCC" =3D yes -a "$ICC" =3D no; then - CFLAGS=3D"-Wall -Wmissing-prototypes -Wpointer-arith" + CFLAGS=3D"-Wall -Wpointer-arith" + # not valid for C++ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -= Wmissing-prototypes" >&5 +$as_echo_n "checking whether $CC supports -Wmissing-prototypes... " >&6; } +if ${pgac_cv_prog_cc_cflags__Wmissing_prototypes+:} false; then : + $as_echo_n "(cached) " >&6 +else + pgac_save_CFLAGS=3D$CFLAGS +CFLAGS=3D"$pgac_save_CFLAGS -Wmissing-prototypes" +ac_save_c_werror_flag=3D$ac_c_werror_flag +ac_c_werror_flag=3Dyes +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + pgac_cv_prog_cc_cflags__Wmissing_prototypes=3Dyes +else + pgac_cv_prog_cc_cflags__Wmissing_prototypes=3Dno +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_c_werror_flag=3D$ac_save_c_werror_flag +CFLAGS=3D"$pgac_save_CFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__= Wmissing_prototypes" >&5 +$as_echo "$pgac_cv_prog_cc_cflags__Wmissing_prototypes" >&6; } +if test x"$pgac_cv_prog_cc_cflags__Wmissing_prototypes" =3D x"yes"; then + CFLAGS=3D"$CFLAGS -Wmissing-prototypes" +fi + # These work in some but not all gcc versions { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -= Wdeclaration-after-statement" >&5 $as_echo_n "checking whether $CC supports -Wdeclaration-after-statement...= " >&6; } diff --git a/configure.in b/configure.in index c878b4e..011e4c4 100644 --- a/configure.in +++ b/configure.in @@ -440,7 +440,9 @@ fi # but has its own. Also check other compiler-specific flags here. =20 if test "$GCC" =3D yes -a "$ICC" =3D no; then - CFLAGS=3D"-Wall -Wmissing-prototypes -Wpointer-arith" + CFLAGS=3D"-Wall -Wpointer-arith" + # not valid for C++ + PGAC_PROG_CC_CFLAGS_OPT([-Wmissing-prototypes]) # These work in some but not all gcc versions PGAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement]) PGAC_PROG_CC_CFLAGS_OPT([-Wendif-labels]) --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0006-Remove-unnecessary-prototypes.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0006-Remove-unnecessary-prototypes.patch" =46rom 69259fa4f5fb0f28cbceda63fb2f2f425bcab7d8 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 06/27] Remove unnecessary prototypes Prototypes for functions implementing V1-callable functions are no longer necessary. --- contrib/bloom/bloom.h | 1 - contrib/btree_gist/btree_gist.h | 10 ---------- contrib/dblink/dblink.h | 24 ------------------------ contrib/isn/isn.h | 19 ------------------- contrib/pgcrypto/pgcrypto.h | 13 ------------- contrib/tablefunc/tablefunc.h | 9 --------- 6 files changed, 76 deletions(-) diff --git a/contrib/bloom/bloom.h b/contrib/bloom/bloom.h index bc451a0..18f5127 100644 --- a/contrib/bloom/bloom.h +++ b/contrib/bloom/bloom.h @@ -174,7 +174,6 @@ typedef BloomScanOpaqueData *BloomScanOpaque; =20 /* blutils.c */ extern void _PG_init(void); -extern Datum blhandler(PG_FUNCTION_ARGS); extern void initBloomState(BloomState *state, Relation index); extern void BloomFillMetapage(Relation index, Page metaPage); extern void BloomInitMetapage(Relation index); diff --git a/contrib/btree_gist/btree_gist.h b/contrib/btree_gist/btree_gis= t.h index dcffbb5..191202a 100644 --- a/contrib/btree_gist/btree_gist.h +++ b/contrib/btree_gist/btree_gist.h @@ -34,14 +34,4 @@ enum gbtree_type gbt_t_inet }; =20 - - -/* - * Generic btree functions - */ - -Datum gbtreekey_in(PG_FUNCTION_ARGS); - -Datum gbtreekey_out(PG_FUNCTION_ARGS); - #endif diff --git a/contrib/dblink/dblink.h b/contrib/dblink/dblink.h index 1b94912..1102236 100644 --- a/contrib/dblink/dblink.h +++ b/contrib/dblink/dblink.h @@ -36,28 +36,4 @@ =20 #include "fmgr.h" =20 -/* - * External declarations - */ -extern Datum dblink_connect(PG_FUNCTION_ARGS); -extern Datum dblink_disconnect(PG_FUNCTION_ARGS); -extern Datum dblink_open(PG_FUNCTION_ARGS); -extern Datum dblink_close(PG_FUNCTION_ARGS); -extern Datum dblink_fetch(PG_FUNCTION_ARGS); -extern Datum dblink_record(PG_FUNCTION_ARGS); -extern Datum dblink_send_query(PG_FUNCTION_ARGS); -extern Datum dblink_get_result(PG_FUNCTION_ARGS); -extern Datum dblink_get_connections(PG_FUNCTION_ARGS); -extern Datum dblink_is_busy(PG_FUNCTION_ARGS); -extern Datum dblink_cancel_query(PG_FUNCTION_ARGS); -extern Datum dblink_error_message(PG_FUNCTION_ARGS); -extern Datum dblink_exec(PG_FUNCTION_ARGS); -extern Datum dblink_get_pkey(PG_FUNCTION_ARGS); -extern Datum dblink_build_sql_insert(PG_FUNCTION_ARGS); -extern Datum dblink_build_sql_delete(PG_FUNCTION_ARGS); -extern Datum dblink_build_sql_update(PG_FUNCTION_ARGS); -extern Datum dblink_current_query(PG_FUNCTION_ARGS); -extern Datum dblink_get_notify(PG_FUNCTION_ARGS); -extern Datum dblink_fdw_validator(PG_FUNCTION_ARGS); - #endif /* DBLINK_H */ diff --git a/contrib/isn/isn.h b/contrib/isn/isn.h index d8291c2..e1a52b2 100644 --- a/contrib/isn/isn.h +++ b/contrib/isn/isn.h @@ -30,25 +30,6 @@ typedef uint64 ean13; #define PG_GETARG_EAN13(n) PG_GETARG_INT64(n) #define PG_RETURN_EAN13(x) PG_RETURN_INT64(x) =20 -extern Datum isn_out(PG_FUNCTION_ARGS); -extern Datum ean13_out(PG_FUNCTION_ARGS); -extern Datum ean13_in(PG_FUNCTION_ARGS); -extern Datum isbn_in(PG_FUNCTION_ARGS); -extern Datum ismn_in(PG_FUNCTION_ARGS); -extern Datum issn_in(PG_FUNCTION_ARGS); -extern Datum upc_in(PG_FUNCTION_ARGS); - -extern Datum isbn_cast_from_ean13(PG_FUNCTION_ARGS); -extern Datum ismn_cast_from_ean13(PG_FUNCTION_ARGS); -extern Datum issn_cast_from_ean13(PG_FUNCTION_ARGS); -extern Datum upc_cast_from_ean13(PG_FUNCTION_ARGS); - -extern Datum is_valid(PG_FUNCTION_ARGS); -extern Datum make_valid(PG_FUNCTION_ARGS); - -extern Datum accept_weak_input(PG_FUNCTION_ARGS); -extern Datum weak_input_status(PG_FUNCTION_ARGS); - extern void initialize(void); =20 #endif /* ISN_H */ diff --git a/contrib/pgcrypto/pgcrypto.h b/contrib/pgcrypto/pgcrypto.h index dfc7a10..65a1ed3 100644 --- a/contrib/pgcrypto/pgcrypto.h +++ b/contrib/pgcrypto/pgcrypto.h @@ -34,17 +34,4 @@ =20 #include "fmgr.h" =20 -/* exported functions */ -Datum pg_digest(PG_FUNCTION_ARGS); -Datum pg_hmac(PG_FUNCTION_ARGS); -Datum pg_gen_salt(PG_FUNCTION_ARGS); -Datum pg_gen_salt_rounds(PG_FUNCTION_ARGS); -Datum pg_crypt(PG_FUNCTION_ARGS); -Datum pg_encrypt(PG_FUNCTION_ARGS); -Datum pg_decrypt(PG_FUNCTION_ARGS); -Datum pg_encrypt_iv(PG_FUNCTION_ARGS); -Datum pg_decrypt_iv(PG_FUNCTION_ARGS); -Datum pg_random_bytes(PG_FUNCTION_ARGS); -Datum pg_random_uuid(PG_FUNCTION_ARGS); - #endif diff --git a/contrib/tablefunc/tablefunc.h b/contrib/tablefunc/tablefunc.h index 3477ed8..34d44a8 100644 --- a/contrib/tablefunc/tablefunc.h +++ b/contrib/tablefunc/tablefunc.h @@ -36,13 +36,4 @@ =20 #include "fmgr.h" =20 -/* - * External declarations - */ -extern Datum normal_rand(PG_FUNCTION_ARGS); -extern Datum crosstab(PG_FUNCTION_ARGS); -extern Datum crosstab_hash(PG_FUNCTION_ARGS); -extern Datum connectby_text(PG_FUNCTION_ARGS); -extern Datum connectby_text_serial(PG_FUNCTION_ARGS); - #endif /* TABLEFUNC_H */ --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0007-Fix-incorrect-type-cast.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0007-Fix-incorrect-type-cast.patch" =46rom be0494cefb5e4a34c57f491ff44829395374720d Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 07/27] Fix incorrect type cast --- src/backend/access/gin/ginscan.c | 2 +- src/include/access/gin_private.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/access/gin/ginscan.c b/src/backend/access/gin/gins= can.c index bfa86b5..77ca097 100644 --- a/src/backend/access/gin/ginscan.c +++ b/src/backend/access/gin/ginscan.c @@ -147,7 +147,7 @@ ginFillScanKey(GinScanOpaque so, OffsetNumber attnum, key->nuserentries =3D nUserQueryValues; =20 key->scanEntry =3D (GinScanEntry *) palloc(sizeof(GinScanEntry) * nQueryV= alues); - key->entryRes =3D (bool *) palloc0(sizeof(bool) * nQueryValues); + key->entryRes =3D (GinTernaryValue *) palloc0(sizeof(GinTernaryValue) * n= QueryValues); =20 key->query =3D query; key->queryValues =3D queryValues; diff --git a/src/include/access/gin_private.h b/src/include/access/gin_priv= ate.h index 68cfe0c..fa6ddad 100644 --- a/src/include/access/gin_private.h +++ b/src/include/access/gin_private.h @@ -788,7 +788,7 @@ typedef struct GinScanKeyData int nadditional; =20 /* array of check flags, reported to consistentFn */ - bool *entryRes; + GinTernaryValue *entryRes; bool (*boolConsistentFn) (GinScanKey key); GinTernaryValue (*triConsistentFn) (GinScanKey key); FmgrInfo *consistentFmgrInfo; --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0008-Add-necessary-type-cast.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0008-Add-necessary-type-cast.patch" =46rom fc1fc82238496f527e870df489694f2c8e7844bb Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 08/27] Add necessary type cast --- src/backend/utils/adt/tsginidx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/adt/tsginidx.c b/src/backend/utils/adt/tsgin= idx.c index c953f53..d4945b0 100644 --- a/src/backend/utils/adt/tsginidx.c +++ b/src/backend/utils/adt/tsginidx.c @@ -302,7 +302,7 @@ gin_tsquery_consistent(PG_FUNCTION_ARGS) * query. */ gcv.first_item =3D item =3D GETQUERY(query); - gcv.check =3D check; + gcv.check =3D (GinTernaryValue *) check; gcv.map_item_operand =3D (int *) (extra_data[0]); gcv.need_recheck =3D recheck; =20 --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0009-Rename-some-typedefs-to-avoid-name-conflicts.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0009-Rename-some-typedefs-to-avoid-name-conflicts.patch" =46rom 34a45d8172fb36790523b90a6d7ee238d4adbf8b Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 09/27] Rename some typedefs to avoid name conflicts C++ does not like that in struct _archiveHandle some of the fields have the same name as a typedef. This changes the meaning of the typedef in the scope of the struct, causing warnings and possibly other problems. Rename the types so they have names distinct from the struct fields. --- src/bin/pg_dump/pg_backup.h | 4 +- src/bin/pg_dump/pg_backup_archiver.c | 10 +-- src/bin/pg_dump/pg_backup_archiver.h | 114 +++++++++++++++++--------------= ---- 3 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h index 4afa92f..dac8383 100644 --- a/src/bin/pg_dump/pg_backup.h +++ b/src/bin/pg_dump/pg_backup.h @@ -221,7 +221,7 @@ typedef int DumpId; =20 typedef int (*DataDumperPtr) (Archive *AH, void *userArg); =20 -typedef void (*SetupWorkerPtr) (Archive *AH); +typedef void (*SetupWorkerPtrType) (Archive *AH); =20 /* * Main archiver interface. @@ -268,7 +268,7 @@ extern Archive *OpenArchive(const char *FileSpec, const= ArchiveFormat fmt); /* Create a new archive */ extern Archive *CreateArchive(const char *FileSpec, const ArchiveFormat fm= t, const int compression, ArchiveMode mode, - SetupWorkerPtr setupDumpWorker); + SetupWorkerPtrType setupDumpWorker); =20 /* The --list option */ extern void PrintTOCSummary(Archive *AH); diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_back= up_archiver.c index 05bdbdb..5a0c1fb 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -56,7 +56,7 @@ static const char *modulename =3D gettext_noop("archiver"= ); =20 =20 static ArchiveHandle *_allocAH(const char *FileSpec, const ArchiveFormat f= mt, - const int compression, ArchiveMode mode, SetupWorkerPtr setupWorkerPtr); + const int compression, ArchiveMode mode, SetupWorkerPtrType setupWorkerP= tr); static void _getObjectDescription(PQExpBuffer buf, TocEntry *te, ArchiveHandle *AH); static void _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData, b= ool acl_pass); @@ -197,7 +197,7 @@ setupRestoreWorker(Archive *AHX) /* Public */ Archive * CreateArchive(const char *FileSpec, const ArchiveFormat fmt, - const int compression, ArchiveMode mode, SetupWorkerPtr setupDumpWorker) + const int compression, ArchiveMode mode, SetupWorkerPtrType setupDumpWor= ker) =20 { ArchiveHandle *AH =3D _allocAH(FileSpec, fmt, compression, mode, setupDum= pWorker); @@ -2217,7 +2217,7 @@ _discoverArchiveFormat(ArchiveHandle *AH) */ static ArchiveHandle * _allocAH(const char *FileSpec, const ArchiveFormat fmt, - const int compression, ArchiveMode mode, SetupWorkerPtr setupWorkerPtr) + const int compression, ArchiveMode mode, SetupWorkerPtrType setupWorker= Ptr) { ArchiveHandle *AH; =20 @@ -2371,8 +2371,8 @@ WriteDataChunks(ArchiveHandle *AH, ParallelState *pst= ate) void WriteDataChunksForTocEntry(ArchiveHandle *AH, TocEntry *te) { - StartDataPtr startPtr; - EndDataPtr endPtr; + StartDataPtrType startPtr; + EndDataPtrType endPtr; =20 AH->currToc =3D te; =20 diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_back= up_archiver.h index 0376f2b..b33793f 100644 --- a/src/bin/pg_dump/pg_backup_archiver.h +++ b/src/bin/pg_dump/pg_backup_archiver.h @@ -136,40 +136,40 @@ typedef enum T_Action ACT_RESTORE } T_Action; =20 -typedef void (*ClosePtr) (ArchiveHandle *AH); -typedef void (*ReopenPtr) (ArchiveHandle *AH); -typedef void (*ArchiveEntryPtr) (ArchiveHandle *AH, TocEntry *te); - -typedef void (*StartDataPtr) (ArchiveHandle *AH, TocEntry *te); -typedef void (*WriteDataPtr) (ArchiveHandle *AH, const void *data, size_t = dLen); -typedef void (*EndDataPtr) (ArchiveHandle *AH, TocEntry *te); - -typedef void (*StartBlobsPtr) (ArchiveHandle *AH, TocEntry *te); -typedef void (*StartBlobPtr) (ArchiveHandle *AH, TocEntry *te, Oid oid); -typedef void (*EndBlobPtr) (ArchiveHandle *AH, TocEntry *te, Oid oid); -typedef void (*EndBlobsPtr) (ArchiveHandle *AH, TocEntry *te); - -typedef int (*WriteBytePtr) (ArchiveHandle *AH, const int i); -typedef int (*ReadBytePtr) (ArchiveHandle *AH); -typedef void (*WriteBufPtr) (ArchiveHandle *AH, const void *c, size_t len); -typedef void (*ReadBufPtr) (ArchiveHandle *AH, void *buf, size_t len); -typedef void (*SaveArchivePtr) (ArchiveHandle *AH); -typedef void (*WriteExtraTocPtr) (ArchiveHandle *AH, TocEntry *te); -typedef void (*ReadExtraTocPtr) (ArchiveHandle *AH, TocEntry *te); -typedef void (*PrintExtraTocPtr) (ArchiveHandle *AH, TocEntry *te); -typedef void (*PrintTocDataPtr) (ArchiveHandle *AH, TocEntry *te); - -typedef void (*ClonePtr) (ArchiveHandle *AH); -typedef void (*DeClonePtr) (ArchiveHandle *AH); - -typedef char *(*WorkerJobRestorePtr) (ArchiveHandle *AH, TocEntry *te); -typedef char *(*WorkerJobDumpPtr) (ArchiveHandle *AH, TocEntry *te); -typedef char *(*MasterStartParallelItemPtr) (ArchiveHandle *AH, TocEntry *= te, +typedef void (*ClosePtrType) (ArchiveHandle *AH); +typedef void (*ReopenPtrType) (ArchiveHandle *AH); +typedef void (*ArchiveEntryPtrType) (ArchiveHandle *AH, TocEntry *te); + +typedef void (*StartDataPtrType) (ArchiveHandle *AH, TocEntry *te); +typedef void (*WriteDataPtrType) (ArchiveHandle *AH, const void *data, siz= e_t dLen); +typedef void (*EndDataPtrType) (ArchiveHandle *AH, TocEntry *te); + +typedef void (*StartBlobsPtrType) (ArchiveHandle *AH, TocEntry *te); +typedef void (*StartBlobPtrType) (ArchiveHandle *AH, TocEntry *te, Oid oid= ); +typedef void (*EndBlobPtrType) (ArchiveHandle *AH, TocEntry *te, Oid oid); +typedef void (*EndBlobsPtrType) (ArchiveHandle *AH, TocEntry *te); + +typedef int (*WriteBytePtrType) (ArchiveHandle *AH, const int i); +typedef int (*ReadBytePtrType) (ArchiveHandle *AH); +typedef void (*WriteBufPtrType) (ArchiveHandle *AH, const void *c, size_t = len); +typedef void (*ReadBufPtrType) (ArchiveHandle *AH, void *buf, size_t len); +typedef void (*SaveArchivePtrType) (ArchiveHandle *AH); +typedef void (*WriteExtraTocPtrType) (ArchiveHandle *AH, TocEntry *te); +typedef void (*ReadExtraTocPtrType) (ArchiveHandle *AH, TocEntry *te); +typedef void (*PrintExtraTocPtrType) (ArchiveHandle *AH, TocEntry *te); +typedef void (*PrintTocDataPtrType) (ArchiveHandle *AH, TocEntry *te); + +typedef void (*ClonePtrType) (ArchiveHandle *AH); +typedef void (*DeClonePtrType) (ArchiveHandle *AH); + +typedef char *(*WorkerJobRestorePtrType) (ArchiveHandle *AH, TocEntry *te); +typedef char *(*WorkerJobDumpPtrType) (ArchiveHandle *AH, TocEntry *te); +typedef char *(*MasterStartParallelItemPtrType) (ArchiveHandle *AH, TocEnt= ry *te, T_Action act); -typedef int (*MasterEndParallelItemPtr) (ArchiveHandle *AH, TocEntry *te, +typedef int (*MasterEndParallelItemPtrType) (ArchiveHandle *AH, TocEntry *= te, const char *str, T_Action act); =20 -typedef size_t (*CustomOutPtr) (ArchiveHandle *AH, const void *buf, size_t= len); +typedef size_t (*CustomOutPtrType) (ArchiveHandle *AH, const void *buf, si= ze_t len); =20 typedef enum { @@ -242,42 +242,42 @@ struct _archiveHandle size_t lookaheadLen; /* Length of data in lookahead */ pgoff_t lookaheadPos; /* Current read position in lookahead buffer */ =20 - ArchiveEntryPtr ArchiveEntryPtr; /* Called for each metadata object */ - StartDataPtr StartDataPtr; /* Called when table data is about to be + ArchiveEntryPtrType ArchiveEntryPtr; /* Called for each metadata object */ + StartDataPtrType StartDataPtr; /* Called when table data is about to be * dumped */ - WriteDataPtr WriteDataPtr; /* Called to send some table data to the + WriteDataPtrType WriteDataPtr; /* Called to send some table data to the * archive */ - EndDataPtr EndDataPtr; /* Called when table data dump is finished */ - WriteBytePtr WriteBytePtr; /* Write a byte to output */ - ReadBytePtr ReadBytePtr; /* Read a byte from an archive */ - WriteBufPtr WriteBufPtr; /* Write a buffer of output to the archive */ - ReadBufPtr ReadBufPtr; /* Read a buffer of input from the archive */ - ClosePtr ClosePtr; /* Close the archive */ - ReopenPtr ReopenPtr; /* Reopen the archive */ - WriteExtraTocPtr WriteExtraTocPtr; /* Write extra TOC entry data + EndDataPtrType EndDataPtr; /* Called when table data dump is finished */ + WriteBytePtrType WriteBytePtr; /* Write a byte to output */ + ReadBytePtrType ReadBytePtr; /* Read a byte from an archive */ + WriteBufPtrType WriteBufPtr; /* Write a buffer of output to the archive */ + ReadBufPtrType ReadBufPtr; /* Read a buffer of input from the archive */ + ClosePtrType ClosePtr; /* Close the archive */ + ReopenPtrType ReopenPtr; /* Reopen the archive */ + WriteExtraTocPtrType WriteExtraTocPtr; /* Write extra TOC entry data * associated with the current archive * format */ - ReadExtraTocPtr ReadExtraTocPtr; /* Read extr info associated with + ReadExtraTocPtrType ReadExtraTocPtr; /* Read extr info associated with * archie format */ - PrintExtraTocPtr PrintExtraTocPtr; /* Extra TOC info for format */ - PrintTocDataPtr PrintTocDataPtr; + PrintExtraTocPtrType PrintExtraTocPtr; /* Extra TOC info for format */ + PrintTocDataPtrType PrintTocDataPtr; =20 - StartBlobsPtr StartBlobsPtr; - EndBlobsPtr EndBlobsPtr; - StartBlobPtr StartBlobPtr; - EndBlobPtr EndBlobPtr; + StartBlobsPtrType StartBlobsPtr; + EndBlobsPtrType EndBlobsPtr; + StartBlobPtrType StartBlobPtr; + EndBlobPtrType EndBlobPtr; =20 - MasterStartParallelItemPtr MasterStartParallelItemPtr; - MasterEndParallelItemPtr MasterEndParallelItemPtr; + MasterStartParallelItemPtrType MasterStartParallelItemPtr; + MasterEndParallelItemPtrType MasterEndParallelItemPtr; =20 - SetupWorkerPtr SetupWorkerPtr; - WorkerJobDumpPtr WorkerJobDumpPtr; - WorkerJobRestorePtr WorkerJobRestorePtr; + SetupWorkerPtrType SetupWorkerPtr; + WorkerJobDumpPtrType WorkerJobDumpPtr; + WorkerJobRestorePtrType WorkerJobRestorePtr; =20 - ClonePtr ClonePtr; /* Clone format-specific fields */ - DeClonePtr DeClonePtr; /* Clean up cloned fields */ + ClonePtrType ClonePtr; /* Clone format-specific fields */ + DeClonePtrType DeClonePtr; /* Clean up cloned fields */ =20 - CustomOutPtr CustomOutPtr; /* Alternative script output routine */ + CustomOutPtrType CustomOutPtr; /* Alternative script output routine */ =20 /* Stuff for direct DB connection */ char *archdbname; /* DB name *read* from archive */ --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0010-Reorder-some-things.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0010-Reorder-some-things.patch" =46rom c8363af9978e978cb860e0410fe31a39d49a7366 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 10/27] Reorder some things Forward declarations of static variables are not possible in C++, so move the full definition before its use. --- src/port/pg_crc32c_sb8.c | 136 +++++++++++++++++++++++--------------------= ---- 1 file changed, 67 insertions(+), 69 deletions(-) diff --git a/src/port/pg_crc32c_sb8.c b/src/port/pg_crc32c_sb8.c index 2680e36..c7e03e9 100644 --- a/src/port/pg_crc32c_sb8.c +++ b/src/port/pg_crc32c_sb8.c @@ -22,8 +22,6 @@ =20 #include "port/pg_crc32c.h" =20 -static const uint32 pg_crc32c_table[8][256]; - /* Accumulate one input byte */ #ifdef WORDS_BIGENDIAN #define CRC8(x) pg_crc32c_table[0][((crc >> 24) ^ (x)) & 0xFF] ^ (crc << 8) @@ -31,73 +29,6 @@ static const uint32 pg_crc32c_table[8][256]; #define CRC8(x) pg_crc32c_table[0][(crc ^ (x)) & 0xFF] ^ (crc >> 8) #endif =20 -pg_crc32c -pg_comp_crc32c_sb8(pg_crc32c crc, const void *data, size_t len) -{ - const unsigned char *p =3D data; - const uint32 *p4; - - /* - * Handle 0-3 initial bytes one at a time, so that the loop below starts - * with a pointer aligned to four bytes. - */ - while (len > 0 && ((uintptr_t) p & 3)) - { - crc =3D CRC8(*p++); - len--; - } - - /* - * Process eight bytes of data at a time. - */ - p4 =3D (const uint32 *) p; - while (len >=3D 8) - { - uint32 a =3D *p4++ ^ crc; - uint32 b =3D *p4++; - -#ifdef WORDS_BIGENDIAN - const uint8 c0 =3D b; - const uint8 c1 =3D b >> 8; - const uint8 c2 =3D b >> 16; - const uint8 c3 =3D b >> 24; - const uint8 c4 =3D a; - const uint8 c5 =3D a >> 8; - const uint8 c6 =3D a >> 16; - const uint8 c7 =3D a >> 24; -#else - const uint8 c0 =3D b >> 24; - const uint8 c1 =3D b >> 16; - const uint8 c2 =3D b >> 8; - const uint8 c3 =3D b; - const uint8 c4 =3D a >> 24; - const uint8 c5 =3D a >> 16; - const uint8 c6 =3D a >> 8; - const uint8 c7 =3D a; -#endif - - crc =3D - pg_crc32c_table[0][c0] ^ pg_crc32c_table[1][c1] ^ - pg_crc32c_table[2][c2] ^ pg_crc32c_table[3][c3] ^ - pg_crc32c_table[4][c4] ^ pg_crc32c_table[5][c5] ^ - pg_crc32c_table[6][c6] ^ pg_crc32c_table[7][c7]; - - len -=3D 8; - } - - /* - * Handle any remaining bytes one at a time. - */ - p =3D (const unsigned char *) p4; - while (len > 0) - { - crc =3D CRC8(*p++); - len--; - } - - return crc; -} - /* * Lookup tables for the slicing-by-8 algorithm, for the so-called Castagn= oli * polynomial (the same that is used e.g. in iSCSI), 0x1EDC6F41. Using @@ -1167,3 +1098,70 @@ static const uint32 pg_crc32c_table[8][256] =3D { } #endif /* WORDS_BIGENDIAN */ }; + +pg_crc32c +pg_comp_crc32c_sb8(pg_crc32c crc, const void *data, size_t len) +{ + const unsigned char *p =3D data; + const uint32 *p4; + + /* + * Handle 0-3 initial bytes one at a time, so that the loop below starts + * with a pointer aligned to four bytes. + */ + while (len > 0 && ((uintptr_t) p & 3)) + { + crc =3D CRC8(*p++); + len--; + } + + /* + * Process eight bytes of data at a time. + */ + p4 =3D (const uint32 *) p; + while (len >=3D 8) + { + uint32 a =3D *p4++ ^ crc; + uint32 b =3D *p4++; + +#ifdef WORDS_BIGENDIAN + const uint8 c0 =3D b; + const uint8 c1 =3D b >> 8; + const uint8 c2 =3D b >> 16; + const uint8 c3 =3D b >> 24; + const uint8 c4 =3D a; + const uint8 c5 =3D a >> 8; + const uint8 c6 =3D a >> 16; + const uint8 c7 =3D a >> 24; +#else + const uint8 c0 =3D b >> 24; + const uint8 c1 =3D b >> 16; + const uint8 c2 =3D b >> 8; + const uint8 c3 =3D b; + const uint8 c4 =3D a >> 24; + const uint8 c5 =3D a >> 16; + const uint8 c6 =3D a >> 8; + const uint8 c7 =3D a; +#endif + + crc =3D + pg_crc32c_table[0][c0] ^ pg_crc32c_table[1][c1] ^ + pg_crc32c_table[2][c2] ^ pg_crc32c_table[3][c3] ^ + pg_crc32c_table[4][c4] ^ pg_crc32c_table[5][c5] ^ + pg_crc32c_table[6][c6] ^ pg_crc32c_table[7][c7]; + + len -=3D 8; + } + + /* + * Handle any remaining bytes one at a time. + */ + p =3D (const unsigned char *) p4; + while (len > 0) + { + crc =3D CRC8(*p++); + len--; + } + + return crc; +} --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0011-Add-missing-fields-in-struct-initializations.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0011-Add-missing-fields-in-struct-initializations.patch" =46rom d37cbfa16ce3676fc0dc5436a135953b963a4caa Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 11/27] Add missing fields in struct initializations --- src/bin/psql/tab-complete.c | 64 ++++++++++++++++++++++-------------------= ---- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 1345e4e..c5e5dbc 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -884,54 +884,54 @@ typedef struct #define THING_NO_SHOW (THING_NO_CREATE | THING_NO_DROP) =20 static const pgsql_thing_t words_after_create[] =3D { - {"ACCESS METHOD", NULL, NULL}, - {"AGGREGATE", NULL, &Query_for_list_of_aggregates}, - {"CAST", NULL, NULL}, /* Casts have complex structures for names, so + {"ACCESS METHOD", NULL, NULL, 0}, + {"AGGREGATE", NULL, &Query_for_list_of_aggregates, 0}, + {"CAST", NULL, NULL, 0}, /* Casts have complex structures for names, so * skip it */ - {"COLLATION", "SELECT pg_catalog.quote_ident(collname) FROM pg_catalog.pg= _collation WHERE collencoding IN (-1, pg_catalog.pg_char_to_encoding(pg_cat= alog.getdatabaseencoding())) AND substring(pg_catalog.quote_ident(collname)= ,1,%d)=3D'%s'"}, + {"COLLATION", "SELECT pg_catalog.quote_ident(collname) FROM pg_catalog.pg= _collation WHERE collencoding IN (-1, pg_catalog.pg_char_to_encoding(pg_cat= alog.getdatabaseencoding())) AND substring(pg_catalog.quote_ident(collname)= ,1,%d)=3D'%s'", NULL, 0}, =20 /* * CREATE CONSTRAINT TRIGGER is not supported here because it is designed * to be used only by pg_dump. */ {"CONFIGURATION", Query_for_list_of_ts_configurations, NULL, THING_NO_SHO= W}, - {"CONVERSION", "SELECT pg_catalog.quote_ident(conname) FROM pg_catalog.pg= _conversion WHERE substring(pg_catalog.quote_ident(conname),1,%d)=3D'%s'"}, - {"DATABASE", Query_for_list_of_databases}, + {"CONVERSION", "SELECT pg_catalog.quote_ident(conname) FROM pg_catalog.pg= _conversion WHERE substring(pg_catalog.quote_ident(conname),1,%d)=3D'%s'", = NULL, 0}, + {"DATABASE", Query_for_list_of_databases, NULL, 0}, {"DICTIONARY", Query_for_list_of_ts_dictionaries, NULL, THING_NO_SHOW}, - {"DOMAIN", NULL, &Query_for_list_of_domains}, - {"EVENT TRIGGER", NULL, NULL}, - {"EXTENSION", Query_for_list_of_extensions}, - {"FOREIGN DATA WRAPPER", NULL, NULL}, - {"FOREIGN TABLE", NULL, NULL}, - {"FUNCTION", NULL, &Query_for_list_of_functions}, - {"GROUP", Query_for_list_of_roles}, - {"LANGUAGE", Query_for_list_of_languages}, - {"INDEX", NULL, &Query_for_list_of_indexes}, - {"MATERIALIZED VIEW", NULL, &Query_for_list_of_matviews}, - {"OPERATOR", NULL, NULL}, /* Querying for this is probably not such a + {"DOMAIN", NULL, &Query_for_list_of_domains, 0}, + {"EVENT TRIGGER", NULL, NULL, 0}, + {"EXTENSION", Query_for_list_of_extensions, NULL, 0}, + {"FOREIGN DATA WRAPPER", NULL, NULL, 0}, + {"FOREIGN TABLE", NULL, NULL, 0}, + {"FUNCTION", NULL, &Query_for_list_of_functions, 0}, + {"GROUP", Query_for_list_of_roles, NULL, 0}, + {"LANGUAGE", Query_for_list_of_languages, NULL, 0}, + {"INDEX", NULL, &Query_for_list_of_indexes, 0}, + {"MATERIALIZED VIEW", NULL, &Query_for_list_of_matviews, 0}, + {"OPERATOR", NULL, NULL, 0},/* Querying for this is probably not such a * good idea. */ {"OWNED", NULL, NULL, THING_NO_CREATE}, /* for DROP OWNED BY ... */ {"PARSER", Query_for_list_of_ts_parsers, NULL, THING_NO_SHOW}, - {"POLICY", NULL, NULL}, - {"ROLE", Query_for_list_of_roles}, - {"RULE", "SELECT pg_catalog.quote_ident(rulename) FROM pg_catalog.pg_rule= s WHERE substring(pg_catalog.quote_ident(rulename),1,%d)=3D'%s'"}, - {"SCHEMA", Query_for_list_of_schemas}, - {"SEQUENCE", NULL, &Query_for_list_of_sequences}, - {"SERVER", Query_for_list_of_servers}, - {"TABLE", NULL, &Query_for_list_of_tables}, - {"TABLESPACE", Query_for_list_of_tablespaces}, + {"POLICY", NULL, NULL, 0}, + {"ROLE", Query_for_list_of_roles, NULL, 0}, + {"RULE", "SELECT pg_catalog.quote_ident(rulename) FROM pg_catalog.pg_rule= s WHERE substring(pg_catalog.quote_ident(rulename),1,%d)=3D'%s'", NULL, 0}, + {"SCHEMA", Query_for_list_of_schemas, NULL, 0}, + {"SEQUENCE", NULL, &Query_for_list_of_sequences, 0}, + {"SERVER", Query_for_list_of_servers, NULL, 0}, + {"TABLE", NULL, &Query_for_list_of_tables, 0}, + {"TABLESPACE", Query_for_list_of_tablespaces, NULL, 0}, {"TEMP", NULL, NULL, THING_NO_DROP}, /* for CREATE TEMP TABLE ... */ {"TEMPLATE", Query_for_list_of_ts_templates, NULL, THING_NO_SHOW}, - {"TEXT SEARCH", NULL, NULL}, - {"TRIGGER", "SELECT pg_catalog.quote_ident(tgname) FROM pg_catalog.pg_tri= gger WHERE substring(pg_catalog.quote_ident(tgname),1,%d)=3D'%s' AND NOT tg= isinternal"}, - {"TYPE", NULL, &Query_for_list_of_datatypes}, + {"TEXT SEARCH", NULL, NULL, 0}, + {"TRIGGER", "SELECT pg_catalog.quote_ident(tgname) FROM pg_catalog.pg_tri= gger WHERE substring(pg_catalog.quote_ident(tgname),1,%d)=3D'%s' AND NOT tg= isinternal", NULL, 0}, + {"TYPE", NULL, &Query_for_list_of_datatypes, 0}, {"UNIQUE", NULL, NULL, THING_NO_DROP}, /* for CREATE UNIQUE INDEX ... */ {"UNLOGGED", NULL, NULL, THING_NO_DROP}, /* for CREATE UNLOGGED TABLE * ... */ - {"USER", Query_for_list_of_roles}, - {"USER MAPPING FOR", NULL, NULL}, - {"VIEW", NULL, &Query_for_list_of_views}, - {NULL} /* end of list */ + {"USER", Query_for_list_of_roles, NULL, 0}, + {"USER MAPPING FOR", NULL, NULL, 0}, + {"VIEW", NULL, &Query_for_list_of_views, 0}, + {NULL, NULL, NULL, 0} /* end of list */ }; =20 =20 --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0012-Separate-enum-from-struct.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0012-Separate-enum-from-struct.patch" =46rom 9dfb2949af5c764bcf553ded32c827dbb9b5eba6 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 12/27] Separate enum from struct Otherwise the enum symbols are not visible outside the struct in C++. --- src/include/utils/jsonb.h | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/include/utils/jsonb.h b/src/include/utils/jsonb.h index fa52afc..48ca9dc 100644 --- a/src/include/utils/jsonb.h +++ b/src/include/utils/jsonb.h @@ -219,6 +219,20 @@ typedef struct #define JB_ROOT_IS_ARRAY(jbp_) ( *(uint32*) VARDATA(jbp_) & JB_FARRAY) =20 =20 +enum jbvType +{ + /* Scalar types */ + jbvNull =3D 0x0, + jbvString, + jbvNumeric, + jbvBool, + /* Composite types */ + jbvArray =3D 0x10, + jbvObject, + /* Binary (i.e. struct Jsonb) jbvArray/jbvObject */ + jbvBinary +}; + /* * JsonbValue: In-memory representation of Jsonb. This is a convenient * deserialized representation, that can easily support using the "val" @@ -227,19 +241,7 @@ typedef struct */ struct JsonbValue { - enum - { - /* Scalar types */ - jbvNull =3D 0x0, - jbvString, - jbvNumeric, - jbvBool, - /* Composite types */ - jbvArray =3D 0x10, - jbvObject, - /* Binary (i.e. struct Jsonb) jbvArray/jbvObject */ - jbvBinary - } type; /* Influences sort order */ + jbvType type; /* Influences sort order */ =20 union { --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0013-Avoid-C-key-words.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0013-Avoid-C-key-words.patch" =46rom 5f83d64832d71fe271b8f27898b33e83c8cee4b8 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 13/27] Avoid C++ key words This is not a long-term solution, because C header files that are included somewhere might have C++ awareness and will break if the key word is defined away. But this shows the list of words that would have to be renamed around the code. --- src/include/c.h | 16 ++++++++++++++++ src/interfaces/ecpg/include/ecpg-pthread-win32.h | 2 ++ src/interfaces/libpq/libpq-int.h | 2 ++ src/pl/plperl/plperl.h | 2 ++ 4 files changed, 22 insertions(+) diff --git a/src/include/c.h b/src/include/c.h index 4ab3f80..a9515d1 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -45,6 +45,22 @@ #ifndef C_H #define C_H =20 +#ifdef __cplusplus +#define class class_ +#define constexpr constexpr_ +#define delete delete_ +#define friend friend_ +#define namespace namespace_ +#define new new_ +#define operator operator_ +#define private private_ +#define public public_ +#define template template_ +#define this this_ +#define typeid typeid_ +#define typename typename_ +#endif + #include "postgres_ext.h" =20 /* Must undef pg_config_ext.h symbols before including pg_config.h */ diff --git a/src/interfaces/ecpg/include/ecpg-pthread-win32.h b/src/interfa= ces/ecpg/include/ecpg-pthread-win32.h index 7e59357..505838f 100644 --- a/src/interfaces/ecpg/include/ecpg-pthread-win32.h +++ b/src/interfaces/ecpg/include/ecpg-pthread-win32.h @@ -9,6 +9,8 @@ =20 #ifndef WIN32 =20 +#undef class +#undef public #include #else =20 diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-= int.h index a94ead0..b2f2d74 100644 --- a/src/interfaces/libpq/libpq-int.h +++ b/src/interfaces/libpq/libpq-int.h @@ -34,6 +34,8 @@ #ifdef WIN32 #include "pthread-win32.h" #else +#undef class +#undef public #include #endif #include diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h index 0146d60..1ed68a4 100644 --- a/src/pl/plperl/plperl.h +++ b/src/pl/plperl/plperl.h @@ -43,6 +43,8 @@ #endif =20 =20 +#undef class +#undef public /* required for perl API */ #include "EXTERN.h" #include "perl.h" --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0014-Set-up-for-static-asserts-in-C.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0014-Set-up-for-static-asserts-in-C.patch" =46rom dc0be2c9b096545d7f95bf44336a9e92715c629c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 14/27] Set up for static asserts in C++ This doesn't appear to work yet. It might need a really new compiler. --- src/include/c.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/include/c.h b/src/include/c.h index a9515d1..cbefc47 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -756,14 +756,26 @@ typedef NameData *Name; * about a negative width for a struct bit-field. This will not include a * helpful error message, but it beats not getting an error at all. */ +#ifdef __cplusplus +#if __cpp_static_assert >=3D 201411 +#define _Static_assert(condition, errmessage) static_assert(condition, err= message) +#define HAVE__STATIC_ASSERT 1 +#endif +#endif + #ifdef HAVE__STATIC_ASSERT #define StaticAssertStmt(condition, errmessage) \ do { _Static_assert(condition, errmessage); } while(0) #define StaticAssertExpr(condition, errmessage) \ ({ StaticAssertStmt(condition, errmessage); true; }) #else /* !HAVE__STATIC_ASSERT */ +#ifdef __cplusplus +#define StaticAssertStmt(condition, errmessage) \ + ((void) 0) +#else #define StaticAssertStmt(condition, errmessage) \ ((void) sizeof(struct { int static_assert_failure : (condition) ? 1 : -1;= })) +#endif #define StaticAssertExpr(condition, errmessage) \ StaticAssertStmt(condition, errmessage) #endif /* HAVE__STATIC_ASSERT */ --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0015-Fix-function-prototypes-for-C.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0015-Fix-function-prototypes-for-C.patch" =46rom b8eb3e6c31d50f1e2d14e0f4996cc58debdc6aac Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 15/27] Fix function prototypes for C++ C++ needs to have the right number of arguments in function signatures. --- src/backend/nodes/nodeFuncs.c | 28 ++++++++++++++-------------- src/include/nodes/nodeFuncs.h | 20 ++++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/backend/nodes/nodeFuncs.c b/src/backend/nodes/nodeFuncs.c index 3997441..311b86d 100644 --- a/src/backend/nodes/nodeFuncs.c +++ b/src/backend/nodes/nodeFuncs.c @@ -28,10 +28,10 @@ static bool expression_returns_set_walker(Node *node, void *context); static int leftmostLoc(int loc1, int loc2); static bool fix_opfuncids_walker(Node *node, void *context); -static bool planstate_walk_subplans(List *plans, bool (*walker) (), +static bool planstate_walk_subplans(List *plans, bool (*walker) (void *, v= oid *), void *context); static bool planstate_walk_members(List *plans, PlanState **planstates, - bool (*walker) (), void *context); + bool (*walker) (void *, void *), void *context); =20 =20 /* @@ -1849,7 +1849,7 @@ check_functions_in_node(Node *node, check_function_ca= llback checker, =20 bool expression_tree_walker(Node *node, - bool (*walker) (), + bool (*walker) (void *, void *), void *context) { ListCell *temp; @@ -2236,7 +2236,7 @@ expression_tree_walker(Node *node, */ bool query_tree_walker(Query *query, - bool (*walker) (), + bool (*walker) (void *, void *), void *context, int flags) { @@ -2280,7 +2280,7 @@ query_tree_walker(Query *query, */ bool range_table_walker(List *rtable, - bool (*walker) (), + bool (*walker) (void *, void *), void *context, int flags) { @@ -2395,7 +2395,7 @@ range_table_walker(List *rtable, =20 Node * expression_tree_mutator(Node *node, - Node *(*mutator) (), + Node *(*mutator) (void *, void *), void *context) { /* @@ -3038,7 +3038,7 @@ expression_tree_mutator(Node *node, */ Query * query_tree_mutator(Query *query, - Node *(*mutator) (), + Node *(*mutator) (void *, void *), void *context, int flags) { @@ -3077,7 +3077,7 @@ query_tree_mutator(Query *query, */ List * range_table_mutator(List *rtable, - Node *(*mutator) (), + Node *(*mutator) (void *, void *), void *context, int flags) { @@ -3144,7 +3144,7 @@ range_table_mutator(List *rtable, */ bool query_or_expression_tree_walker(Node *node, - bool (*walker) (), + bool (*walker) (void *, void *), void *context, int flags) { @@ -3167,7 +3167,7 @@ query_or_expression_tree_walker(Node *node, */ Node * query_or_expression_tree_mutator(Node *node, - Node *(*mutator) (), + Node *(*mutator) (void *, void *), void *context, int flags) { @@ -3198,7 +3198,7 @@ query_or_expression_tree_mutator(Node *node, */ bool raw_expression_tree_walker(Node *node, - bool (*walker) (), + bool (*walker) (void *, void *), void *context) { ListCell *temp; @@ -3638,7 +3638,7 @@ raw_expression_tree_walker(Node *node, */ bool planstate_tree_walker(PlanState *planstate, - bool (*walker) (), + bool (*walker) (void *, void *), void *context) { Plan *plan =3D planstate->plan; @@ -3722,7 +3722,7 @@ planstate_tree_walker(PlanState *planstate, */ static bool planstate_walk_subplans(List *plans, - bool (*walker) (), + bool (*walker) (void *, void *), void *context) { ListCell *lc; @@ -3748,7 +3748,7 @@ planstate_walk_subplans(List *plans, */ static bool planstate_walk_members(List *plans, PlanState **planstates, - bool (*walker) (), void *context) + bool (*walker) (void *, void *), void *context) { int nplans =3D list_length(plans); int j; diff --git a/src/include/nodes/nodeFuncs.h b/src/include/nodes/nodeFuncs.h index 97af142..82add17 100644 --- a/src/include/nodes/nodeFuncs.h +++ b/src/include/nodes/nodeFuncs.h @@ -50,31 +50,31 @@ extern void set_sa_opfuncid(ScalarArrayOpExpr *opexpr); extern bool check_functions_in_node(Node *node, check_function_callback ch= ecker, void *context); =20 -extern bool expression_tree_walker(Node *node, bool (*walker) (), +extern bool expression_tree_walker(Node *node, bool (*walker) (void *, voi= d *), void *context); -extern Node *expression_tree_mutator(Node *node, Node *(*mutator) (), +extern Node *expression_tree_mutator(Node *node, Node *(*mutator) (void *,= void *), void *context); =20 -extern bool query_tree_walker(Query *query, bool (*walker) (), +extern bool query_tree_walker(Query *query, bool (*walker) (void *, void *= ), void *context, int flags); -extern Query *query_tree_mutator(Query *query, Node *(*mutator) (), +extern Query *query_tree_mutator(Query *query, Node *(*mutator) (void *, v= oid *), void *context, int flags); =20 -extern bool range_table_walker(List *rtable, bool (*walker) (), +extern bool range_table_walker(List *rtable, bool (*walker) (void *, void = *), void *context, int flags); -extern List *range_table_mutator(List *rtable, Node *(*mutator) (), +extern List *range_table_mutator(List *rtable, Node *(*mutator) (void *, v= oid *), void *context, int flags); =20 -extern bool query_or_expression_tree_walker(Node *node, bool (*walker) (), +extern bool query_or_expression_tree_walker(Node *node, bool (*walker) (vo= id *, void *), void *context, int flags); -extern Node *query_or_expression_tree_mutator(Node *node, Node *(*mutator)= (), +extern Node *query_or_expression_tree_mutator(Node *node, Node *(*mutator)= (void *, void *), void *context, int flags); =20 -extern bool raw_expression_tree_walker(Node *node, bool (*walker) (), +extern bool raw_expression_tree_walker(Node *node, bool (*walker) (void *,= void *), void *context); =20 struct PlanState; -extern bool planstate_tree_walker(struct PlanState *planstate, bool (*walk= er) (), +extern bool planstate_tree_walker(struct PlanState *planstate, bool (*walk= er) (void *, void *), void *context); =20 #endif /* NODEFUNCS_H */ --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0016-Fix-fmgr_oldstyle-for-C.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0016-Fix-fmgr_oldstyle-for-C.patch" =46rom 4cbdafcc7a7979b9eeea1ce0def9f528e6125d49 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 16/27] Fix fmgr_oldstyle for C++ C++ needs the function pointer to have the right number of arguments, so some casts are needed here. --- src/backend/utils/fmgr/fmgr.c | 56 ++++++++++++++++++++++++++++-----------= ---- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c index 7e6a60d..1da553b 100644 --- a/src/backend/utils/fmgr/fmgr.c +++ b/src/backend/utils/fmgr/fmgr.c @@ -53,11 +53,29 @@ PGDLLIMPORT fmgr_hook_type fmgr_hook =3D NULL; * with suitably ugly casts in fmgr_oldstyle(). */ #if (defined(__mc68000__) || (defined(__m68k__))) && defined(__ELF__) -typedef int32 (*func_ptr) (); +#define func_ptr_ret int32 #else -typedef char *(*func_ptr) (); +#define func_ptr_ret char* #endif =20 +typedef func_ptr_ret (*func_ptr) (); +typedef func_ptr_ret (*func1_ptr) (Datum, bool); +typedef func_ptr_ret (*func2_ptr) (Datum, Datum); +typedef func_ptr_ret (*func3_ptr) (Datum, Datum, Datum); +typedef func_ptr_ret (*func4_ptr) (Datum, Datum, Datum, Datum); +typedef func_ptr_ret (*func5_ptr) (Datum, Datum, Datum, Datum, Datum); +typedef func_ptr_ret (*func6_ptr) (Datum, Datum, Datum, Datum, Datum, Datu= m); +typedef func_ptr_ret (*func7_ptr) (Datum, Datum, Datum, Datum, Datum, Datu= m, Datum); +typedef func_ptr_ret (*func8_ptr) (Datum, Datum, Datum, Datum, Datum, Datu= m, Datum, Datum); +typedef func_ptr_ret (*func9_ptr) (Datum, Datum, Datum, Datum, Datum, Datu= m, Datum, Datum, Datum); +typedef func_ptr_ret (*func10_ptr) (Datum, Datum, Datum, Datum, Datum, Dat= um, Datum, Datum, Datum, Datum); +typedef func_ptr_ret (*func11_ptr) (Datum, Datum, Datum, Datum, Datum, Dat= um, Datum, Datum, Datum, Datum, Datum); +typedef func_ptr_ret (*func12_ptr) (Datum, Datum, Datum, Datum, Datum, Dat= um, Datum, Datum, Datum, Datum, Datum, Datum); +typedef func_ptr_ret (*func13_ptr) (Datum, Datum, Datum, Datum, Datum, Dat= um, Datum, Datum, Datum, Datum, Datum, Datum, Datum); +typedef func_ptr_ret (*func14_ptr) (Datum, Datum, Datum, Datum, Datum, Dat= um, Datum, Datum, Datum, Datum, Datum, Datum, Datum, Datum); +typedef func_ptr_ret (*func15_ptr) (Datum, Datum, Datum, Datum, Datum, Dat= um, Datum, Datum, Datum, Datum, Datum, Datum, Datum, Datum, Datum); +typedef func_ptr_ret (*func16_ptr) (Datum, Datum, Datum, Datum, Datum, Dat= um, Datum, Datum, Datum, Datum, Datum, Datum, Datum, Datum, Datum, Datum); + /* * For an oldstyle function, fn_extra points to a record like this: */ @@ -658,7 +676,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) switch (n_arguments) { case 0: - returnValue =3D (char *) (*user_fn) (); + returnValue =3D (char *) (user_fn) (); break; case 1: =20 @@ -667,33 +685,33 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) * there are other functions still out there that also rely on * this undocumented hack? */ - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func1_ptr) user_fn) (fcinfo->arg[0], &fcinfo->isnull); break; case 2: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func2_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1]); break; case 3: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func3_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2]); break; case 4: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func4_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3]); break; case 5: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func5_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], fcinfo->arg[4]); break; case 6: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func6_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -701,7 +719,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[5]); break; case 7: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func7_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -710,7 +728,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[6]); break; case 8: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func8_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -720,7 +738,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[7]); break; case 9: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func9_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -731,7 +749,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[8]); break; case 10: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func10_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -743,7 +761,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[9]); break; case 11: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func11_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -756,7 +774,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[10]); break; case 12: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func12_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -770,7 +788,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[11]); break; case 13: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func13_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -785,7 +803,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[12]); break; case 14: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func14_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -801,7 +819,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[13]); break; case 15: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func15_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -818,7 +836,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[14]); break; case 16: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func16_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0017-Don-t-define-bool-in-C.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0017-Don-t-define-bool-in-C.patch" =46rom f75db7835d76456a4152aa12a8878c8f5ba47662 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 17/27] Don't define bool in C++ --- src/test/thread/thread_test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/thread/thread_test.c b/src/test/thread/thread_test.c index 26d1949..d7cf5ef 100644 --- a/src/test/thread/thread_test.c +++ b/src/test/thread/thread_test.c @@ -24,6 +24,8 @@ #include "postgres.h" #else /* From src/include/c.h" */ +#ifndef __cplusplus + #ifndef bool typedef char bool; #endif @@ -37,6 +39,8 @@ typedef char bool; #endif #endif =20 +#endif + #include #include #include --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0018-Change-TimeoutId-from-enum-to-integer.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0018-Change-TimeoutId-from-enum-to-integer.patch" =46rom de2fa8c6ecd92449c893db07dc3458a713c2269d Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 18/27] Change TimeoutId from enum to integer RegisterTimeout() treats it like an integer. C++ doesn't like enums to be treated that way. --- src/include/utils/timeout.h | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/include/utils/timeout.h b/src/include/utils/timeout.h index 260c013..15a0f09 100644 --- a/src/include/utils/timeout.h +++ b/src/include/utils/timeout.h @@ -20,22 +20,21 @@ * Identifiers for timeout reasons. Note that in case multiple timeouts * trigger at the same time, they are serviced in the order of this enum. */ -typedef enum TimeoutId -{ +typedef int TimeoutId; + /* Predefined timeout reasons */ - STARTUP_PACKET_TIMEOUT, - DEADLOCK_TIMEOUT, - LOCK_TIMEOUT, - STATEMENT_TIMEOUT, - STANDBY_DEADLOCK_TIMEOUT, - STANDBY_TIMEOUT, - STANDBY_LOCK_TIMEOUT, - IDLE_IN_TRANSACTION_SESSION_TIMEOUT, +const int STARTUP_PACKET_TIMEOUT =3D 1; +const int DEADLOCK_TIMEOUT =3D 2; +const int LOCK_TIMEOUT =3D 3; +const int STATEMENT_TIMEOUT =3D 4; +const int STANDBY_DEADLOCK_TIMEOUT =3D 5; +const int STANDBY_TIMEOUT =3D 6; +const int STANDBY_LOCK_TIMEOUT =3D 7; +const int IDLE_IN_TRANSACTION_SESSION_TIMEOUT =3D 8; /* First user-definable timeout reason */ - USER_TIMEOUT, +const int USER_TIMEOUT =3D 9; /* Maximum number of timeout reasons */ - MAX_TIMEOUTS =3D 16 -} TimeoutId; +const int MAX_TIMEOUTS =3D 16; =20 /* callback function signature */ typedef void (*timeout_handler_proc) (void); --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0019-Add-explicit-cast-for-casting-away-volatile.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0019-Add-explicit-cast-for-casting-away-volatile.patch" =46rom a8f8b2ea81f0364cc31d125800b705c701a9105f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 19/27] Add explicit cast for casting away volatile --- contrib/pg_stat_statements/pg_stat_statements.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_s= tat_statements/pg_stat_statements.c index 8ce24e0..37aac98 100644 --- a/contrib/pg_stat_statements/pg_stat_statements.c +++ b/contrib/pg_stat_statements/pg_stat_statements.c @@ -1547,7 +1547,7 @@ pg_stat_statements_internal(FunctionCallInfo fcinfo, volatile pgssEntry *e =3D (volatile pgssEntry *) entry; =20 SpinLockAcquire(&e->mutex); - tmp =3D e->counters; + tmp =3D const_cast(e)->counters; SpinLockRelease(&e->mutex); } =20 --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0020-Add-more-extern-key-words.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0020-Add-more-extern-key-words.patch" =46rom 42c4728e8cc0937485e4d3957d1768d6b6736e7d Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 20/27] Add more extern key words C++ needs those to make the definitions visible externally. This is not compatible with C. --- src/backend/access/rmgrdesc/xlogdesc.c | 2 +- src/backend/access/transam/xlog.c | 4 ++-- src/backend/storage/ipc/dsm_impl.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backend/access/rmgrdesc/xlogdesc.c b/src/backend/access/rm= grdesc/xlogdesc.c index 62ed1dc..d3ea5e6 100644 --- a/src/backend/access/rmgrdesc/xlogdesc.c +++ b/src/backend/access/rmgrdesc/xlogdesc.c @@ -23,7 +23,7 @@ /* * GUC support */ -const struct config_enum_entry wal_level_options[] =3D { +extern const struct config_enum_entry wal_level_options[] =3D { {"minimal", WAL_LEVEL_MINIMAL, false}, {"replica", WAL_LEVEL_REPLICA, false}, {"archive", WAL_LEVEL_REPLICA, true}, /* deprecated */ diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam= /xlog.c index acd95aa..6732151 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -125,7 +125,7 @@ static double PrevCheckPointDistance =3D 0; /* * GUC support */ -const struct config_enum_entry sync_method_options[] =3D { +extern const struct config_enum_entry sync_method_options[] =3D { {"fsync", SYNC_METHOD_FSYNC, false}, #ifdef HAVE_FSYNC_WRITETHROUGH {"fsync_writethrough", SYNC_METHOD_FSYNC_WRITETHROUGH, false}, @@ -147,7 +147,7 @@ const struct config_enum_entry sync_method_options[] = =3D { * Although only "on", "off", and "always" are documented, * we accept all the likely variants of "on" and "off". */ -const struct config_enum_entry archive_mode_options[] =3D { +extern const struct config_enum_entry archive_mode_options[] =3D { {"always", ARCHIVE_MODE_ALWAYS, false}, {"on", ARCHIVE_MODE_ON, false}, {"off", ARCHIVE_MODE_OFF, false}, diff --git a/src/backend/storage/ipc/dsm_impl.c b/src/backend/storage/ipc/d= sm_impl.c index c07a5c6..3b6a710 100644 --- a/src/backend/storage/ipc/dsm_impl.c +++ b/src/backend/storage/ipc/dsm_impl.c @@ -91,7 +91,7 @@ static bool dsm_impl_mmap(dsm_op op, dsm_handle handle, S= ize request_size, #endif static int errcode_for_dynamic_shared_memory(void); =20 -const struct config_enum_entry dynamic_shared_memory_options[] =3D { +extern const struct config_enum_entry dynamic_shared_memory_options[] =3D { #ifdef USE_DSM_POSIX {"posix", DSM_IMPL_POSIX, false}, #endif --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0021-Workaround-for-using-typdef-ed-ints-in-loops.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0021-Workaround-for-using-typdef-ed-ints-in-loops.patch" =46rom c420d60d7e54f3e7799a15210413f34eb133de95 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 21/27] Workaround for using typdef'ed ints in loops Types made from int don't have a ++ operator in C++, so they can't be used in for loops without further work. Needs more research --- src/backend/access/transam/xact.c | 4 ++-- src/backend/commands/tablecmds.c | 2 +- src/backend/storage/smgr/md.c | 8 ++++---- src/backend/storage/smgr/smgr.c | 6 +++--- src/backend/utils/adt/dbsize.c | 6 +++--- src/bin/pgbench/pgbench.c | 5 ++++- src/common/relpath.c | 4 ++-- 7 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam= /xact.c index e11b229..6fd16e7 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -5456,7 +5456,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed, for (i =3D 0; i < parsed->nrels; i++) { SMgrRelation srel =3D smgropen(parsed->xnodes[i], InvalidBackendId); - ForkNumber fork; + int fork; =20 for (fork =3D 0; fork <=3D MAX_FORKNUM; fork++) XLogDropRelation(parsed->xnodes[i], fork); @@ -5566,7 +5566,7 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, Transac= tionId xid) for (i =3D 0; i < parsed->nrels; i++) { SMgrRelation srel =3D smgropen(parsed->xnodes[i], InvalidBackendId); - ForkNumber fork; + int fork; =20 for (fork =3D 0; fork <=3D MAX_FORKNUM; fork++) XLogDropRelation(parsed->xnodes[i], fork); diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablec= mds.c index 86e9814..d10d8bc 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -9557,7 +9557,7 @@ ATExecSetTableSpace(Oid tableOid, Oid newTableSpace, = LOCKMODE lockmode) Relation pg_class; HeapTuple tuple; Form_pg_class rd_rel; - ForkNumber forkNum; + int forkNum; List *reltoastidxids =3D NIL; ListCell *lc; =20 diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c index 1287142..21bc909 100644 --- a/src/backend/storage/smgr/md.c +++ b/src/backend/storage/smgr/md.c @@ -400,7 +400,7 @@ mdunlink(RelFileNodeBackend rnode, ForkNumber forkNum, = bool isRedo) /* Now do the per-fork work */ if (forkNum =3D=3D InvalidForkNumber) { - for (forkNum =3D 0; forkNum <=3D MAX_FORKNUM; forkNum++) + for (int forkNum =3D 0; forkNum <=3D MAX_FORKNUM; forkNum++) mdunlinkfork(rnode, forkNum, isRedo); } else @@ -1127,7 +1127,7 @@ mdsync(void) hash_seq_init(&hstat, pendingOpsTable); while ((entry =3D (PendingOperationEntry *) hash_seq_search(&hstat)) !=3D= NULL) { - ForkNumber forknum; + int forknum; =20 /* * If the entry is new then don't process it this time; it might @@ -1532,7 +1532,7 @@ RememberFsyncRequest(RelFileNode rnode, ForkNumber fo= rknum, BlockNumber segno) if (forknum =3D=3D InvalidForkNumber) { /* remove requests for all forks */ - for (forknum =3D 0; forknum <=3D MAX_FORKNUM; forknum++) + for (int forknum =3D 0; forknum <=3D MAX_FORKNUM; forknum++) { bms_free(entry->requests[forknum]); entry->requests[forknum] =3D NULL; @@ -1564,7 +1564,7 @@ RememberFsyncRequest(RelFileNode rnode, ForkNumber fo= rknum, BlockNumber segno) if (entry->rnode.dbNode =3D=3D rnode.dbNode) { /* remove requests for all forks */ - for (forknum =3D 0; forknum <=3D MAX_FORKNUM; forknum++) + for (int forknum =3D 0; forknum <=3D MAX_FORKNUM; forknum++) { bms_free(entry->requests[forknum]); entry->requests[forknum] =3D NULL; diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smg= r.c index 94aa952..73eb118 100644 --- a/src/backend/storage/smgr/smgr.c +++ b/src/backend/storage/smgr/smgr.c @@ -296,7 +296,7 @@ void smgrclose(SMgrRelation reln) { SMgrRelation *owner; - ForkNumber forknum; + int forknum; =20 for (forknum =3D 0; forknum <=3D MAX_FORKNUM; forknum++) (*(smgrsw[reln->smgr_which].smgr_close)) (reln, forknum); @@ -415,7 +415,7 @@ smgrdounlink(SMgrRelation reln, bool isRedo) { RelFileNodeBackend rnode =3D reln->smgr_rnode; int which =3D reln->smgr_which; - ForkNumber forknum; + int forknum; =20 /* Close the forks at smgr level */ for (forknum =3D 0; forknum <=3D MAX_FORKNUM; forknum++) @@ -472,7 +472,7 @@ smgrdounlinkall(SMgrRelation *rels, int nrels, bool isR= edo) { int i =3D 0; RelFileNodeBackend *rnodes; - ForkNumber forknum; + int forknum; =20 if (nrels =3D=3D 0) return; diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c index 3167bad..dd43033 100644 --- a/src/backend/utils/adt/dbsize.c +++ b/src/backend/utils/adt/dbsize.c @@ -342,7 +342,7 @@ calculate_toast_table_size(Oid toastrelid) { int64 size =3D 0; Relation toastRel; - ForkNumber forkNum; + int forkNum; ListCell *lc; List *indexlist; =20 @@ -387,7 +387,7 @@ static int64 calculate_table_size(Relation rel) { int64 size =3D 0; - ForkNumber forkNum; + int forkNum; =20 /* * heap size, including FSM and VM @@ -427,7 +427,7 @@ calculate_indexes_size(Relation rel) { Oid idxOid =3D lfirst_oid(cell); Relation idxRel; - ForkNumber forkNum; + int forkNum; =20 idxRel =3D relation_open(idxOid, AccessShareLock); =20 diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index 8027955..78c3872 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -3655,9 +3655,12 @@ main(int argc, char **argv) fprintf(stderr, "query mode (-M) should be specified before any trans= action scripts (-f or -b)\n"); exit(1); } - for (querymode =3D 0; querymode < NUM_QUERYMODE; querymode++) + for (int qm =3D 0; qm < NUM_QUERYMODE; qm++) if (strcmp(optarg, QUERYMODE[querymode]) =3D=3D 0) + { + querymode =3D qm; break; + } if (querymode >=3D NUM_QUERYMODE) { fprintf(stderr, "invalid query mode (-M): \"%s\"\n", diff --git a/src/common/relpath.c b/src/common/relpath.c index 1aacb81..8bb918a 100644 --- a/src/common/relpath.c +++ b/src/common/relpath.c @@ -47,7 +47,7 @@ const char *const forkNames[] =3D { ForkNumber forkname_to_number(const char *forkName) { - ForkNumber forkNum; + int forkNum; =20 for (forkNum =3D 0; forkNum <=3D MAX_FORKNUM; forkNum++) if (strcmp(forkNames[forkNum], forkName) =3D=3D 0) @@ -78,7 +78,7 @@ forkname_to_number(const char *forkName) int forkname_chars(const char *str, ForkNumber *fork) { - ForkNumber forkNum; + int forkNum; =20 for (forkNum =3D 1; forkNum <=3D MAX_FORKNUM; forkNum++) { --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0022-Disable-conflicting-function.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0022-Disable-conflicting-function.patch" =46rom 75495adef7bc6e3fe01e7b859a353efd5174cb4a Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 22/27] Disable conflicting function This function conflicts with a function in the backend. FIXME --- contrib/xml2/xpath.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/xml2/xpath.c b/contrib/xml2/xpath.c index ac28996..d654884 100644 --- a/contrib/xml2/xpath.c +++ b/contrib/xml2/xpath.c @@ -90,6 +90,7 @@ pgxml_parser_init(PgXmlStrictness strictness) * definitions for the contrib module, this won't be called. */ =20 +#ifdef BROKEN PG_FUNCTION_INFO_V1(xml_is_well_formed); =20 Datum @@ -124,6 +125,7 @@ xml_is_well_formed(PG_FUNCTION_ARGS) =20 PG_RETURN_BOOL(result); } +#endif =20 =20 /* Encodes special characters (<, >, &, " and \r) as XML entities */ --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0023-Add-C-linkage-to-replacement-declaration-of-fdatasyn.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="0023-Add-C-linkage-to-replacement-declaration-of-fdatasyn.pa"; filename*1="tch" =46rom e23bbc59fed34b155bcdbff5317eea776e06a72d Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 23/27] Add C linkage to replacement declaration of fdatasync --- src/include/c.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/c.h b/src/include/c.h index cbefc47..18af261 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -1099,7 +1099,7 @@ extern int vsnprintf(char *str, size_t count, const c= har *fmt, va_list args); #endif =20 #if defined(HAVE_FDATASYNC) && !HAVE_DECL_FDATASYNC -extern int fdatasync(int fildes); +extern "C" int fdatasync(int fildes); #endif =20 /* If strtoq() exists, rename it to the more standard strtoll() */ --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0024-Make-inet_net_-to-C-linkage.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0024-Make-inet_net_-to-C-linkage.patch" =46rom 27910bcbea854f36ee993af79a63ad184933c98a Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 24/27] Make inet_net_?to? C linkage These functions can also be declared by the operating system, so we need to match the linkage. --- src/include/port.h | 2 +- src/include/utils/builtins.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/port.h b/src/include/port.h index 455f723..2607a3d 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -450,7 +450,7 @@ extern int pg_codepage_to_encoding(UINT cp); #endif =20 /* port/inet_net_ntop.c */ -extern char *inet_net_ntop(int af, const void *src, int bits, +extern "C" char *inet_net_ntop(int af, const void *src, int bits, char *dst, size_t size); =20 /* port/pgcheckdir.c */ diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index 2ae212a..3f71457 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -947,7 +947,7 @@ extern char *inet_cidr_ntop(int af, const void *src, in= t bits, char *dst, size_t size); =20 /* inet_net_pton.c */ -extern int inet_net_pton(int af, const char *src, +extern "C" int inet_net_pton(int af, const char *src, void *dst, size_t size); =20 /* network.c */ --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0025-Add-C-linkage-to-functions-exported-by-plugins.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="0025-Add-C-linkage-to-functions-exported-by-plugins.patch" =46rom a3124209270fde6c7cc1fd00244eb968326b7e1f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 25/27] Add C linkage to functions exported by plugins This is required so dlsym() can find them reliably. --- contrib/bloom/bloom.h | 2 +- contrib/earthdistance/earthdistance.c | 2 +- contrib/hstore/hstore.h | 4 ++-- contrib/ltree/ltree.h | 2 ++ contrib/pg_stat_statements/pg_stat_statements.c | 2 ++ contrib/seg/seg.c | 6 ++++++ src/include/fmgr.h | 6 +++--- src/pl/plperl/plperl.c | 2 ++ src/pl/plpgsql/src/plpgsql.h | 2 +- src/pl/plpython/plpy_main.c | 2 ++ src/pl/tcl/pltcl.c | 2 ++ src/test/regress/regress.c | 8 +++++--- 12 files changed, 29 insertions(+), 11 deletions(-) diff --git a/contrib/bloom/bloom.h b/contrib/bloom/bloom.h index 18f5127..c80d9b0 100644 --- a/contrib/bloom/bloom.h +++ b/contrib/bloom/bloom.h @@ -173,7 +173,7 @@ typedef struct BloomScanOpaqueData typedef BloomScanOpaqueData *BloomScanOpaque; =20 /* blutils.c */ -extern void _PG_init(void); +extern "C" void _PG_init(void); extern void initBloomState(BloomState *state, Relation index); extern void BloomFillMetapage(Relation index, Page metaPage); extern void BloomInitMetapage(Relation index); diff --git a/contrib/earthdistance/earthdistance.c b/contrib/earthdistance/= earthdistance.c index 861b166..305be5d 100644 --- a/contrib/earthdistance/earthdistance.c +++ b/contrib/earthdistance/earthdistance.c @@ -112,7 +112,7 @@ geo_distance(PG_FUNCTION_ARGS) } #else /* !USE_FLOAT8_BYVAL */ =20 -double *geo_distance(Point *pt1, Point *pt2); +extern "C" double *geo_distance(Point *pt1, Point *pt2); =20 double * geo_distance(Point *pt1, Point *pt2) diff --git a/contrib/hstore/hstore.h b/contrib/hstore/hstore.h index 6bab08b..373a5f1 100644 --- a/contrib/hstore/hstore.h +++ b/contrib/hstore/hstore.h @@ -194,8 +194,8 @@ extern Pairs *hstoreArrayToPairs(ArrayType *a, int *npa= irs); #if HSTORE_POLLUTE_NAMESPACE #define HSTORE_POLLUTE(newname_,oldname_) \ PG_FUNCTION_INFO_V1(oldname_); \ - Datum newname_(PG_FUNCTION_ARGS); \ - Datum oldname_(PG_FUNCTION_ARGS) { return newname_(fcinfo); } \ + extern "C" Datum newname_(PG_FUNCTION_ARGS); \ + extern "C" Datum oldname_(PG_FUNCTION_ARGS) { return newname_(fcinfo); } \ extern int no_such_variable #else #define HSTORE_POLLUTE(newname_,oldname_) \ diff --git a/contrib/ltree/ltree.h b/contrib/ltree/ltree.h index c604357..277b9a4 100644 --- a/contrib/ltree/ltree.h +++ b/contrib/ltree/ltree.h @@ -130,6 +130,7 @@ typedef struct =20 =20 /* use in array iterator */ +extern "C" { Datum ltree_isparent(PG_FUNCTION_ARGS); Datum ltree_risparent(PG_FUNCTION_ARGS); Datum ltq_regex(PG_FUNCTION_ARGS); @@ -154,6 +155,7 @@ Datum ltree_textadd(PG_FUNCTION_ARGS); =20 /* Util function */ Datum ltree_in(PG_FUNCTION_ARGS); +} =20 bool ltree_execute(ITEM *curitem, void *checkval, bool calcnot, bool (*chkcond) (void *checkval, ITEM *val)); diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_s= tat_statements/pg_stat_statements.c index 37aac98..fb6bd82 100644 --- a/contrib/pg_stat_statements/pg_stat_statements.c +++ b/contrib/pg_stat_statements/pg_stat_statements.c @@ -275,8 +275,10 @@ static bool pgss_save; /* whether to save stats acro= ss shutdown */ =20 /*---- Function declarations ----*/ =20 +extern "C" { void _PG_init(void); void _PG_fini(void); +} =20 PG_FUNCTION_INFO_V1(pg_stat_statements_reset); PG_FUNCTION_INFO_V1(pg_stat_statements_1_2); diff --git a/contrib/seg/seg.c b/contrib/seg/seg.c index c6c082b..45d3503 100644 --- a/contrib/seg/seg.c +++ b/contrib/seg/seg.c @@ -47,6 +47,7 @@ PG_FUNCTION_INFO_V1(seg_center); /* ** GiST support methods */ +extern "C" { bool gseg_consistent(GISTENTRY *entry, SEG *query, StrategyNumber strategy, @@ -61,11 +62,13 @@ bool gseg_internal_consistent(SEG *key, SEG *query, St= rategyNumber strategy); SEG *gseg_union(GistEntryVector *entryvec, int *sizep); SEG *gseg_binary_union(SEG *r1, SEG *r2, int *sizep); bool *gseg_same(SEG *b1, SEG *b2, bool *result); +} =20 =20 /* ** R-tree support functions */ +extern "C" { bool seg_same(SEG *a, SEG *b); bool seg_contains_int(SEG *a, int *b); bool seg_contains_float4(SEG *a, float4 *b); @@ -80,16 +83,19 @@ bool seg_over_right(SEG *a, SEG *b); SEG *seg_union(SEG *a, SEG *b); SEG *seg_inter(SEG *a, SEG *b); void rt_seg_size(SEG *a, float *sz); +} =20 /* ** Various operators */ +extern "C" { int32 seg_cmp(SEG *a, SEG *b); bool seg_lt(SEG *a, SEG *b); bool seg_le(SEG *a, SEG *b); bool seg_gt(SEG *a, SEG *b); bool seg_ge(SEG *a, SEG *b); bool seg_different(SEG *a, SEG *b); +} =20 /* ** Auxiliary funxtions diff --git a/src/include/fmgr.h b/src/include/fmgr.h index 0491e2e..191235f 100644 --- a/src/include/fmgr.h +++ b/src/include/fmgr.h @@ -348,8 +348,8 @@ typedef const Pg_finfo_record *(*PGFInfoFunction) (void= ); * doesn't hurt to add PGDLLIMPORT in case they don't. */ #define PG_FUNCTION_INFO_V1(funcname) \ -Datum funcname(PG_FUNCTION_ARGS); \ -extern PGDLLEXPORT const Pg_finfo_record * CppConcat(pg_finfo_,funcname)(v= oid); \ +extern "C" Datum funcname(PG_FUNCTION_ARGS); \ +extern "C" PGDLLEXPORT const Pg_finfo_record * CppConcat(pg_finfo_,funcnam= e)(void); \ const Pg_finfo_record * \ CppConcat(pg_finfo_,funcname) (void) \ { \ @@ -418,7 +418,7 @@ typedef const Pg_magic_struct *(*PGModuleMagicFunction)= (void); #define PG_MAGIC_FUNCTION_NAME_STRING "Pg_magic_func" =20 #define PG_MODULE_MAGIC \ -extern PGDLLEXPORT const Pg_magic_struct *PG_MAGIC_FUNCTION_NAME(void); \ +extern "C" PGDLLEXPORT const Pg_magic_struct *PG_MAGIC_FUNCTION_NAME(void)= ; \ const Pg_magic_struct * \ PG_MAGIC_FUNCTION_NAME(void) \ { \ diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index 2cd7614..c5c0617 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -244,7 +244,9 @@ static plperl_call_data *current_call_data =3D NULL; /********************************************************************** * Forward declarations **********************************************************************/ +extern "C" { void _PG_init(void); +} =20 static PerlInterpreter *plperl_init_interp(void); static void plperl_destroy_interp(PerlInterpreter **); diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h index b416e50..f2ddd94 100644 --- a/src/pl/plpgsql/src/plpgsql.h +++ b/src/pl/plpgsql/src/plpgsql.h @@ -1085,7 +1085,7 @@ extern void plpgsql_HashTableInit(void); /* * Functions in pl_handler.c */ -extern void _PG_init(void); +extern "C" void _PG_init(void); =20 /* * Functions in pl_exec.c diff --git a/src/pl/plpython/plpy_main.c b/src/pl/plpython/plpy_main.c index 860b804..efd3bf0 100644 --- a/src/pl/plpython/plpy_main.c +++ b/src/pl/plpython/plpy_main.c @@ -39,7 +39,9 @@ #define plpython_inline_handler plpython3_inline_handler #endif =20 +extern "C" { extern void _PG_init(void); +} =20 PG_MODULE_MAGIC; =20 diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c index 2a335aa..20578ad 100644 --- a/src/pl/tcl/pltcl.c +++ b/src/pl/tcl/pltcl.c @@ -205,7 +205,9 @@ static const TclExceptionNameMap exception_name_map[] = =3D { /********************************************************************** * Forward declarations **********************************************************************/ +extern "C" { void _PG_init(void); +} =20 static void pltcl_init_interp(pltcl_interp_desc *interp_desc, bool pltrust= ed); static pltcl_interp_desc *pltcl_fetch_interp(bool pltrusted); diff --git a/src/test/regress/regress.c b/src/test/regress/regress.c index e7826a4..9621cc1 100644 --- a/src/test/regress/regress.c +++ b/src/test/regress/regress.c @@ -45,8 +45,8 @@ =20 extern PATH *poly2path(POLYGON *poly); extern void regress_lseg_construct(LSEG *lseg, Point *pt1, Point *pt2); -extern char *reverse_name(char *string); -extern int oldstyle_length(int n, text *t); +extern "C" char *reverse_name(char *string); +extern "C" int oldstyle_length(int n, text *t); =20 #ifdef PG_MODULE_MAGIC PG_MODULE_MAGIC; @@ -240,8 +240,10 @@ typedef struct double radius; } WIDGET; =20 +extern "C" { WIDGET *widget_in(char *str); -char *widget_out(WIDGET *widget); +char *widget_out(WIDGET * widget); +} =20 #define NARGS 3 =20 --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0026-Add-C-linkage-to-client-libraries-in-non-systematic-.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="0026-Add-C-linkage-to-client-libraries-in-non-systematic-.pa"; filename*1="tch" =46rom 92ff0ab38c864c2edea49a83ec0e46c33bf71e64 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 26/27] Add C linkage to client libraries in non-systematic ways --- src/backend/utils/mb/encnames.c | 3 +++ src/include/mb/pg_wchar.h | 12 ++++++++++++ src/include/port.h | 6 ++++++ src/interfaces/ecpg/pgtypeslib/dt.h | 2 +- src/interfaces/libpq/Makefile | 2 +- src/interfaces/libpq/libpq-fe.h | 1 + src/interfaces/libpq/pqexpbuffer.h | 9 +++++++++ 7 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/backend/utils/mb/encnames.c b/src/backend/utils/mb/encname= s.c index 11099b8..dc62e90 100644 --- a/src/backend/utils/mb/encnames.c +++ b/src/backend/utils/mb/encnames.c @@ -6,6 +6,9 @@ */ #ifdef FRONTEND #include "postgres_fe.h" +#ifdef LIBPQ +#include "libpq-fe.h" +#endif #else #include "postgres.h" #include "utils/builtins.h" diff --git a/src/include/mb/pg_wchar.h b/src/include/mb/pg_wchar.h index 24e8d0d..f5dd098 100644 --- a/src/include/mb/pg_wchar.h +++ b/src/include/mb/pg_wchar.h @@ -491,11 +491,23 @@ extern int pg_bind_textdomain_codeset(const char *dom= ainname); #endif =20 extern int pg_valid_client_encoding(const char *name); +#ifdef LIBPQ +extern "C" { +#endif extern int pg_valid_server_encoding(const char *name); +#ifdef LIBPQ +} +#endif =20 extern unsigned char *unicode_to_utf8(pg_wchar c, unsigned char *utf8strin= g); extern pg_wchar utf8_to_unicode(const unsigned char *c); +#ifdef LIBPQ +extern "C" { +#endif extern int pg_utf_mblen(const unsigned char *); +#ifdef LIBPQ +} +#endif extern unsigned char *pg_do_encoding_conversion(unsigned char *src, int le= n, int src_encoding, int dest_encoding); diff --git a/src/include/port.h b/src/include/port.h index 2607a3d..831e9be 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -460,8 +460,14 @@ extern int pg_check_dir(const char *dir); extern int pg_mkdir_p(char *path, int omode); =20 /* port/pqsignal.c */ +#ifdef LIBPQ +extern "C" { +#endif typedef void (*pqsigfunc) (int signo); extern pqsigfunc pqsignal(int signo, pqsigfunc func); +#ifdef LIBPQ +} +#endif =20 /* port/quotes.c */ extern char *escape_single_quotes_ascii(const char *src); diff --git a/src/interfaces/ecpg/pgtypeslib/dt.h b/src/interfaces/ecpg/pgty= peslib/dt.h index c0c3ac1..ad77b05 100644 --- a/src/interfaces/ecpg/pgtypeslib/dt.h +++ b/src/interfaces/ecpg/pgtypeslib/dt.h @@ -365,7 +365,7 @@ void GetCurrentDateTime(struct tm *); int date2j(int, int, int); void TrimTrailingZeros(char *); void dt2time(double, int *, int *, int *, fsec_t *); -int PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp * d, +extern "C" int PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestam= p * d, int *year, int *month, int *day, int *hour, int *minute, int *second, int *tz); diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile index 0b4065e..d71b2c0 100644 --- a/src/interfaces/libpq/Makefile +++ b/src/interfaces/libpq/Makefile @@ -19,7 +19,7 @@ NAME=3D pq SO_MAJOR_VERSION=3D 5 SO_MINOR_VERSION=3D $(MAJORVERSION) =20 -override CPPFLAGS :=3D -DFRONTEND -DUNSAFE_STAT_OK -I$(srcdir) $(CPPFLAGS= ) -I$(top_builddir)/src/port -I$(top_srcdir)/src/port +override CPPFLAGS :=3D -DFRONTEND -DLIBPQ -DUNSAFE_STAT_OK -I$(srcdir) $(= CPPFLAGS) -I$(top_builddir)/src/port -I$(top_srcdir)/src/port ifneq ($(PORTNAME), win32) override CFLAGS +=3D $(PTHREAD_CFLAGS) endif diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-f= e.h index 9ca0756..c8f5293 100644 --- a/src/interfaces/libpq/libpq-fe.h +++ b/src/interfaces/libpq/libpq-fe.h @@ -501,6 +501,7 @@ extern void PQclear(PGresult *res); extern void PQfreemem(void *ptr); =20 /* Exists for backward compatibility. bjm 2003-03-24 */ +extern void PQfreeNotify(PGnotify *notify); #define PQfreeNotify(ptr) PQfreemem(ptr) =20 /* Error when no password was given. */ diff --git a/src/interfaces/libpq/pqexpbuffer.h b/src/interfaces/libpq/pqex= pbuffer.h index ce87cd5..ba4ac74 100644 --- a/src/interfaces/libpq/pqexpbuffer.h +++ b/src/interfaces/libpq/pqexpbuffer.h @@ -25,6 +25,11 @@ #ifndef PQEXPBUFFER_H #define PQEXPBUFFER_H =20 +#ifdef __cplusplus +extern "C" +{ +#endif + /*------------------------- * PQExpBufferData holds information about an extensible string. * data is the current buffer for the string (allocated with malloc). @@ -179,4 +184,8 @@ extern void appendPQExpBufferChar(PQExpBuffer str, char= ch); extern void appendBinaryPQExpBuffer(PQExpBuffer str, const char *data, size_t datalen); =20 +#ifdef __cplusplus +} +#endif + #endif /* PQEXPBUFFER_H */ --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/x-patch; name="0027-Hack-Disable-volatile-that-causes-mysterious-compile.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="0027-Hack-Disable-volatile-that-causes-mysterious-compile.pa"; filename*1="tch" =46rom 1af627d7881ebcb2a974eb0934a455cb9f806db2 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH 27/27] Hack: Disable volatile that causes mysterious compil= er errors --- src/backend/commands/async.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index 716f1c3..c727788 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -385,7 +385,7 @@ static double asyncQueueUsage(void); static void asyncQueueFillWarning(void); static bool SignalBackends(void); static void asyncQueueReadAllNotifications(void); -static bool asyncQueueProcessPageEntries(volatile QueuePosition *current, +static bool asyncQueueProcessPageEntries(/*volatile*/ QueuePosition *curre= nt, QueuePosition stop, char *page_buffer); static void asyncQueueAdvanceTail(void); @@ -1741,7 +1741,7 @@ ProcessNotifyInterrupt(void) static void asyncQueueReadAllNotifications(void) { - volatile QueuePosition pos; + /*volatile*/ QueuePosition pos; QueuePosition oldpos; QueuePosition head; bool advanceTail; @@ -1901,7 +1901,7 @@ asyncQueueReadAllNotifications(void) * The QueuePosition *current is advanced past all processed messages. */ static bool -asyncQueueProcessPageEntries(volatile QueuePosition *current, +asyncQueueProcessPageEntries(/*volatile*/ QueuePosition *current, QueuePosition stop, char *page_buffer) { --=20 2.9.3 --------------F26294506435CC8013AB58CF Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --------------F26294506435CC8013AB58CF-- From christian.convey@gmail.com Tue Sep 6 18:57:51 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhLZ9-0004QJ-53 for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Sep 2016 18:57:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bhLZ8-00007W-O3 for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Sep 2016 18:57:50 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bhLXk-0005zV-3P for pgsql-hackers@postgresql.org; Tue, 06 Sep 2016 18:56:24 +0000 Received: from mail-qt0-x232.google.com ([2607:f8b0:400d:c0d::232]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bhLXh-00017d-AJ for pgsql-hackers@postgresql.org; Tue, 06 Sep 2016 18:56:22 +0000 Received: by mail-qt0-x232.google.com with SMTP id 38so71371477qte.1 for ; Tue, 06 Sep 2016 11:56:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=IvdG8XGYOxz+9/53K2d1uzXxLH2yznHattifk2gvK74=; b=e3ltiqyXAOEWi+HNyjm1IBDQMaY6Fu+dWVbMg86vVwBc2f7FbJV/jk92Fnb5u8ggMw wYY8AW9HXeOu624ZABlHu6GcUIcHTf+GJa4wLHuKcETq94yPwCNH21k1e/MRB+lK1xBC WSfGS/esqGczDVAbYqPb9sMf00CMlpzFSFxzQtZR12vPAEwzvVTW8hPZ0m3SYu7ivEEk qSmMw/KmXTvPzfR6fxt1jRX6ZmNWikowDZUR83cZ/dNab0nLOA3X0F2SsB0mWHIcNZu7 q7CTvT8YSS6lwYtwOGFLMAKIuOeL33p56v07171k/UTAmzdBXqL6KMjAfXhDzwpL+m1b 6E7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=IvdG8XGYOxz+9/53K2d1uzXxLH2yznHattifk2gvK74=; b=KloKCG+eRBDk7Tsn+j9Q7bY4ZX1epkbEHdc+2xmZv9LQB/FeyJHcQ0mxvLTzI5ONvM mA2VpAKkKdNnQHsQJsY9ybpA1DFWl8I/NPcLhNse5IidsMr3agjcFF17aFhZk2sRxeYG RQpRhOSUqSJ/2y1sy5pbvbHVnEC32sshyEp+KIKDyuhITKqA6zjpWsSAewIedGw7ShXy m/cGKbgYEtAdu7kCXeauY9duodNS17MXc+XQ2xtRhXbYlK5Ui7uIlp9tkKk+Q3fHwIaR xRJXBkSI3alj2IPwucxNwNcO8GgQa+sRQ98iEg0X4qPa9qFK87pJwompKWI+mH7RvwK+ Lysw== X-Gm-Message-State: AE9vXwMy3o3fFLTXiee57uP5lL8RGZyuhTmDsDyxYSrFTjjbGhUXk2tGdlClP/E2Qs8cDkBCa2l14ZskE+ZpEQ== X-Received: by 10.200.49.48 with SMTP id g45mr16571740qtb.48.1473188180356; Tue, 06 Sep 2016 11:56:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.141.131 with HTTP; Tue, 6 Sep 2016 11:56:18 -0700 (PDT) In-Reply-To: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> From: Christian Convey Date: Tue, 6 Sep 2016 14:56:18 -0400 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Peter Eisentraut , Joy Arulraj Cc: Pg Hackers Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Wed, Aug 31, 2016 at 9:41 AM, Peter Eisentraut wrote: >> Joy, do you have an idea what a *minimally invasive* patch for C++ >> support would look like? That's certainly the first step here. > > I developed a minimally invasive patch for C++ support a few years ago > shortly after I wrote that blog post. Since there appears to have been > some interest here now, I have updated that and split it up into logical > chunks. > > So here you go. Hi folks, I'm ready for my first-ever PG code review, and I was considering tackling this one. I.e., https://commitfest.postgresql.org/10/776/ Could someone help me with a few procedural questions? (1) This page: https://wiki.postgresql.org/wiki/Reviewing_a_Patch lists the current commitfest's manager as "(vacant)". But this page: https://commitfest.postgresql.org/ seems to indicate that a commitfest is currently in progress. Is there a commitfest manager at the moment? (2) It seems like there are still a few big questions about this commit: - Is it wanted at the moment? It didn't seem like there's a consensus about whether or not this enhancement should be merged, even if the patch is pretty minimal. - It seems like there are two competing patch sets in play for this enhancement: Joy's and Peter's. Presumably at most one of them would be merged. Are these signs that I should find a different commit to review for now, so that this one can be further discussed? Thanks very much, Christian -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From hlinnaka@iki.fi Tue Sep 6 19:00:07 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhLbL-0004U8-7h for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Sep 2016 19:00:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bhLbK-0002cM-Qd for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Sep 2016 19:00:06 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bhLZx-0000CQ-7K for pgsql-hackers@postgresql.org; Tue, 06 Sep 2016 18:58:41 +0000 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bhLZu-00018D-1j for pgsql-hackers@postgresql.org; Tue, 06 Sep 2016 18:58:40 +0000 Received: by mail-wm0-x22c.google.com with SMTP id b187so79956220wme.1 for ; Tue, 06 Sep 2016 11:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=KzaIKvIeSGUSf+8PsbpWS/2dMWIrjBt5Dq/gcO0888Q=; b=NrabZVRVwRKMFc3JTeKtNCzNBNO2ozpivvmHViAwG3ZQFVIJTLKk6kD+8FlQKaOL4j AO086IrBpv5VWZNk3oqezw+hXkxPZvbqYr7dDk1xpXs6gj3bl7Sd9DxkaU1Qy9zWsCTa jW2xZqkdDcc/glhjvCIJLLOa4Aea7ufYLwZisopFQPutZore1/KY3myB9858ABZCcq4u aDtG1vbG0Azm/IB+KimtxqYCKqtUoE56fLBtpTJagT2buauNMi+kSBR0evBtZOve8qPd HJxDLmfL2xUc4Gf8yshsDMDowxS9D7BzXvl/Z/QrjhzJmqJFmyb4UzdnWAkF34F05uuz XcCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=KzaIKvIeSGUSf+8PsbpWS/2dMWIrjBt5Dq/gcO0888Q=; b=K+XFFM790V3ehBDRf/G+hUTeZJZ0QkJMuiOrRXql+ggvkNKDYq92TXjYZCstjLa5pF xXHMSvNn/Hz0mDkia/6VElJapIyP5LBpGV4tXfD8N3py0qUpk1fXCJAKo4Gw60eIgrSg 0gvoMD/orvLBRrYDY4nX/n1rUPsPZ18FpD+P1eOcm3enJ1eJVzX3xwLJ2Eej1Uw2lxIP Qq1ij+djQR6CdVKTpuu4Fan5KPABoGGCt3mJW7ypPxccO63Q56UzIViVUXcftWLq/E7N 6sFRblA0OM8XHFQqD+R6dqOO9Dh0td23Ofjx32wD37KX/V51Isvl9mVZiwnbUYqLoxi6 GRUg== X-Gm-Message-State: AE9vXwMPU0gmyAhIiQCZaIK7O81s2EgTTouUOuWT48nFcUzuGU73owijD99W+b7ijWfQzw== X-Received: by 10.28.196.136 with SMTP id u130mr148048wmf.21.1473188316358; Tue, 06 Sep 2016 11:58:36 -0700 (PDT) Received: from [192.168.1.111] (dsl-hkibrasgw1-58c38f-82.dhcp.inet.fi. [88.195.143.82]) by smtp.gmail.com with ESMTPSA id kq2sm34800790wjc.41.2016.09.06.11.58.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Sep 2016 11:58:35 -0700 (PDT) Subject: Re: [GENERAL] C++ port of Postgres To: Peter Eisentraut , Pg Hackers References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> Cc: Jim Nasby From: Heikki Linnakangas Message-ID: Date: Tue, 6 Sep 2016 21:58:34 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 08/31/2016 04:41 PM, Peter Eisentraut wrote: > I developed a minimally invasive patch for C++ support a few years ago > shortly after I wrote that blog post. Since there appears to have been > some interest here now, I have updated that and split it up into logical > chunks. > > So here you go. Looking at this with the POV of what would make sense, even if we don't care about C++. > The patches are numbered approximately in increasing order of dubiosity. > So 0001 is probably a straight bug fix, 0002 and 0003 are arguably > minor bug fixes as well. The patches through 0012 can probably be > considered for committing in some form. After that it gets a bit hackish. 0001-0003 look clear to me as well. 0006 - 0009 also seem OK. The rest really only make sense if we decided to make the switch to C++. - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From tgl@sss.pgh.pa.us Tue Sep 6 19:14:33 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhLpJ-0005BV-M2 for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Sep 2016 19:14:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bhLpJ-0004Ze-8p for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Sep 2016 19:14:33 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bhLnv-0002zd-5W for pgsql-hackers@postgresql.org; Tue, 06 Sep 2016 19:13:07 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bhLnr-0001Os-6U for pgsql-hackers@postgresql.org; Tue, 06 Sep 2016 19:13:05 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u86JCxHW014460; Tue, 6 Sep 2016 15:12:59 -0400 From: Tom Lane To: Christian Convey cc: Peter Eisentraut , Joy Arulraj , fabriziomello@gmail.com, Pg Hackers Subject: Re: [GENERAL] C++ port of Postgres In-reply-to: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> Comments: In-reply-to Christian Convey message dated "Tue, 06 Sep 2016 14:56:18 -0400" Content-Type: text/plain; charset=UTF-8 Date: Tue, 06 Sep 2016 15:12:59 -0400 Message-ID: <14459.1473189179@sss.pgh.pa.us> X-Pg-Spam-Score: -3.0 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Christian Convey writes: > Could someone help me with a few procedural questions? > (1) This page: https://wiki.postgresql.org/wiki/Reviewing_a_Patch > lists the current commitfest's manager as "(vacant)". But this page: > https://commitfest.postgresql.org/ seems to indicate that a commitfest > is currently in progress. Is there a commitfest manager at the > moment? Fabrízio de Royes Mello is it. I guess he hasn't noticed that that page ought to be updated. > (2) It seems like there are still a few big questions about this commit: > - Is it wanted at the moment? It didn't seem like there's a > consensus about whether or not this enhancement should be > merged, even if the patch is pretty minimal. > - It seems like there are two competing patch > sets in play for this enhancement: Joy's and > Peter's. Presumably at most one of them would > be merged. These are things that reviews should be helping to decide. It's probably a squishier topic than some patches, but if you're interested, feel free to read code and weigh in. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From christian.convey@gmail.com Tue Sep 6 19:17:04 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhLrj-0005M7-Uf for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Sep 2016 19:17:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bhLrj-0006VY-B9 for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Sep 2016 19:17:03 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bhLqK-0004l8-ER for pgsql-hackers@postgresql.org; Tue, 06 Sep 2016 19:15:36 +0000 Received: from mail-qk0-x232.google.com ([2607:f8b0:400d:c09::232]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bhLqH-0001TS-V1 for pgsql-hackers@postgresql.org; Tue, 06 Sep 2016 19:15:35 +0000 Received: by mail-qk0-x232.google.com with SMTP id z190so228776994qkc.0 for ; Tue, 06 Sep 2016 12:15:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xrGX3ta8bOwdzMorKwkNqcNVBiK5nfwFC15b7J6l53c=; b=c9NaXYVVqQobEkKTVM7poN958c+LND4d2Mb7Li73kbLFla73GCivdWJGBVEgQejhBk /fmuFCejKYHLo2vbYFM3l2SCz0FP9LEP3sjMKo2GsU27yD/pqSOk6cJ54te2PqEnjclz sbbyBJkkIR21yHTZVNzAdhLmd8tPE9RJrR6Q5gL63YveT4AHOPnVXMA+fq1qvy+Xp33b GhBRWzonbpSx1Op1d0elS4rGESKaW33iI1y8iSNsco3UFxwE9SMtAzLkN4mOZQEGvscm AQoifWwfWd7oPt3n2ulWJOQoMMwaOOE2EFJn03uLYBBm02w/hpHcRGDtBPW0x3w7L35T Ti/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xrGX3ta8bOwdzMorKwkNqcNVBiK5nfwFC15b7J6l53c=; b=gDZspNL2pJEoV6t+eKlxJQFTySYCJvJOd/vSqFgPJs2oG9Fzi0JsVOvN2wQRyI54Su b3D3SWIjs9S8AO1zVDDh/9VqDSG6+/v0b8bQ8xs7gwZpcNvZ3LRMfomdsVLSnXIG9RYd u8N9rwMa3Dgi+ZT7J1LW9PHfL82MnPmvpXM5hYt/KQ93YADxD4VxDj6CCb7D3o1d23b0 y0KbfIuNWvJDyHnOkRi32X7fYowPEEQrVACt3+Xbo4gjw4qzqZUn1TWmy17HW/5LG/Z0 ePxhbRZSuohYwRsBUiCL5n015/9lKkwwuU4L8/ClauBwZgUc/vdfHINOENwTqpYWgN7u bAYg== X-Gm-Message-State: AE9vXwONVd+ADaQWgRpCJbh4XfTlpK9Q6M/AjgRKesOcb5GkUT3xZpWhotDwk+xgzhkFcYiit0ZvOs1rMdv4Lg== X-Received: by 10.55.87.135 with SMTP id l129mr48725575qkb.0.1473189328141; Tue, 06 Sep 2016 12:15:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.141.131 with HTTP; Tue, 6 Sep 2016 12:15:26 -0700 (PDT) In-Reply-To: <14459.1473189179@sss.pgh.pa.us> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> <14459.1473189179@sss.pgh.pa.us> From: Christian Convey Date: Tue, 6 Sep 2016 15:15:26 -0400 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Tom Lane Cc: Peter Eisentraut , Joy Arulraj , fabriziomello@gmail.com, Pg Hackers Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Tue, Sep 6, 2016 at 3:12 PM, Tom Lane wrote: >> (2) It seems like there are still a few big questions about this commit: >> - Is it wanted at the moment? It didn't seem like there's a >> consensus about whether or not this enhancement should be >> merged, even if the patch is pretty minimal. >> - It seems like there are two competing patch >> sets in play for this enhancement: Joy's and >> Peter's. Presumably at most one of them would >> be merged. > > These are things that reviews should be helping to decide. It's probably > a squishier topic than some patches, but if you're interested, feel free > to read code and weigh in. Thanks. It sounds like worst-case scenario, I perform an unneeded review. I'll give it a shot. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From christian.convey@gmail.com Sat Sep 10 21:13:52 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bipay-0008Mi-EV for pgsql-hackers@arkaria.postgresql.org; Sat, 10 Sep 2016 21:13:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bipax-0002ur-Uz for pgsql-hackers@arkaria.postgresql.org; Sat, 10 Sep 2016 21:13:52 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bipZa-0001Lt-Mh for pgsql-hackers@postgresql.org; Sat, 10 Sep 2016 21:12:26 +0000 Received: from mail-qk0-x231.google.com ([2607:f8b0:400d:c09::231]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bipZY-0000Vt-8x for pgsql-hackers@postgresql.org; Sat, 10 Sep 2016 21:12:25 +0000 Received: by mail-qk0-x231.google.com with SMTP id t7so7365753qkh.2 for ; Sat, 10 Sep 2016 14:12:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=i3H49vrlsA0A1TY43kwuZR8zkoxyS7UxoyPQw42JJHE=; b=dzxribimniDxVUHr0vLf2menz5A2z8cM075PdK+TDITDaef+brifSvwoO/lu60im0t GGQzANP1eUHGJSxkOrPc/zQQZN5/ZCxPw33EejV8aGPDzHx84lMzQjX6CNyka/+vtaxT 4XAfXpcut7qUrJIrlrZTEi9Ckw2kCsp48Foi3nxBULfEHu7tm8hCE1zdKFHPFbqKosQK sfClHpPtSslnDn7dks2Iniw/NDowqoSaGky3e5oL4+7KEml7HZu8yMF2xA+Fi2laNdR+ Nnj4UFcSZLup3MfLQ/8Q49se3qD3dMWxImk1pUpICuzmJDcAhqNDipsAsA+CDI5+Z/PZ yrQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=i3H49vrlsA0A1TY43kwuZR8zkoxyS7UxoyPQw42JJHE=; b=B8r/8sxdOe59Tqamg9EsP/F4M+bZSrM7ZHeXsgY7dQZGqrNuOq9C5TTvGBTk/iu2GH D1WX/1FYEqTcfwyPjjvD3MHapZ4BggQ8RNFjNPQlmO3IcqFWraoaoeKcDThtDQim0LgP DiwdkUdr0G93Yjk1DQrKBQ9mCHW7EwqjuWu31PWxneeCQSNglK9hYoB2kp8dmXiPFuMl lCgfWdcvsFDB4rsTbknn8DIyjj3pUWVEuhCpWZGjq93rnIjSJi0IoU1AvwWLk3aqefFA Nb/m84jFllurn/8g882PbRU2Qq+IGfS1V6RYneVMP2WBVF+0pIYclw1DXj6zhGhkNyU1 LE+g== X-Gm-Message-State: AE9vXwOjKVb7g22yoRh8jY3rX5jFQpBryyuMJ6GN+14f9papSXZklW6FwzL4rw4+kDrGfXJL7mAlhFVaBi+Utw== X-Received: by 10.233.221.133 with SMTP id r127mr11509339qkf.64.1473541943489; Sat, 10 Sep 2016 14:12:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.141.131 with HTTP; Sat, 10 Sep 2016 14:12:22 -0700 (PDT) In-Reply-To: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> <14459.1473189179@sss.pgh.pa.us> From: Christian Convey Date: Sat, 10 Sep 2016 17:12:22 -0400 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Tom Lane Cc: Peter Eisentraut , Joy Arulraj , =?UTF-8?Q?Fabr=C3=ADzio_Mello?= , Pg Hackers Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org > Thanks. It sounds like worst-case scenario, I perform an unneeded > review. I'll give it a shot. Hi guys, Apologies for more boring process-related questions, but any pointers would be greatly appreciated... I'm a bit confused about how PG's code-review process is meant to handle this C++ port. My confusion may stem from the combination of my inexperience with the process, and there being two competing patch sets. Here's some background: * My intention was to review Joy's patch. * On "commitfest.postgresql.org" (for 2016-09), the only C++ -related patch I found was Peter's: [1] * I wrongly assumed that the commitfest entry would be for Joy's patch, not Peter's, so I signed up as its reviewer. (That's fine - I don't mind reviewing both authors' patch sets.) But here are my questions: Q1) My understanding of PG's code-review process is that it's a pipeline: Step 1. The discussion starts on the pgsql-hackers mailing list, where the author posts a patch. He/she may also post revised patches based on the discussion. Step 2. A subset of those discussions are modeled by new entries in the commitfest website. Step 3. A subset of those commitfest items get merged. If that's correct, then it sounds like the only way Joy's commit has a chance of acceptance is if Peter's commit is rejected. Because Peter's commit might be merged as part of the 2016-09 commitfest, but Joy's can show up until 2016-11 at the earliest. Is my understanding correct? There seems to be a little ambiguity regarding the exact version of the code to be reviewed. This is true for both Joy's and Peter's submissions: * Joy's email provides a link to a Github repo, but does not specify a particular commit (or even branch) in that repo: [2] * In the email thread, Peter did provide a patch set: [3] but the corresponding commitfest entry references a github branch: [4] So I have a few questions here: Q2) Are authors expected to submit an unambiguous patch to frame the discussion? (I.e,. a specific patch file, or a specific git commit hash, as opposed to a github repo or a github branch.) Q3) Are authors expected to submit a single patch/commit, or is it acceptable / desirable for a large patch to be broken up as Peter has done? Q4) Do we require that any submitted patches appear as attachments on the pgsql-hackers email list, or is a github URL good enough? Q5) (This question is more generic.) I'm accustomed to using Github's pull-request system, where I can engage in dialog regarding specifc lines of a patch. I haven't noticed anything similar being used for PG code reviews, but perhaps I'm just looking in the wrong places. Are all PG code reviews basically just back-and-forth email conversations on the pgsql-hackers list? Thanks, Christian [1] https://commitfest.postgresql.org/10/776/ [2] https://www.postgresql.org/message-id/CABgyVxDBd3EvRdo-Rd6eo8QPEqV8%3DShaU2SJfo16wfE0R-hXTA%40mail.gmail.com [3] https://www.postgresql.org/message-id/bf9de63c-b669-4b8c-d33b-4a5ed11cd5d4%402ndquadrant.com [4] https://github.com/petere/postgresql/tree/commitfest/c%2B%2B -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From tgl@sss.pgh.pa.us Sat Sep 10 22:20:23 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1biqdL-0002d2-8r for pgsql-hackers@arkaria.postgresql.org; Sat, 10 Sep 2016 22:20:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1biqdK-0004Ca-NF for pgsql-hackers@arkaria.postgresql.org; Sat, 10 Sep 2016 22:20:22 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1biqdJ-0004Bk-IO for pgsql-hackers@postgresql.org; Sat, 10 Sep 2016 22:20:21 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1biqdC-00042Q-9h for pgsql-hackers@postgresql.org; Sat, 10 Sep 2016 22:20:20 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u8AMK8Ge021445; Sat, 10 Sep 2016 18:20:08 -0400 From: Tom Lane To: Christian Convey cc: Peter Eisentraut , Joy Arulraj , =?UTF-8?Q?Fabr=C3=ADzio_Mello?= , Pg Hackers Subject: Re: [GENERAL] C++ port of Postgres In-reply-to: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> <14459.1473189179@sss.pgh.pa.us> Comments: In-reply-to Christian Convey message dated "Sat, 10 Sep 2016 17:12:22 -0400" Date: Sat, 10 Sep 2016 18:20:08 -0400 Message-ID: <21444.1473546008@sss.pgh.pa.us> X-Pg-Spam-Score: -3.2 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Christian Convey writes: > If that's correct, then it sounds like the only way Joy's commit has > a chance of acceptance is if Peter's commit is rejected. > Because Peter's commit might be merged as part of the 2016-09 > commitfest, but Joy's can show up until 2016-11 at the earliest. No, we're not that rigid about it. The commitfest mechanism is really mostly meant to ensure that every submission does get looked at within a reasonable amount of time and doesn't get forgotten about. (We do tend to be willing to tell new patches they've got to wait till the next fest, but that's mainly when we're already feeling overloaded by what's in the current queue.) In this case it would be nonsensical to consider only Peter's submission and not Joy's, because part of the issue is whether one's better than the other. > There seems to be a little ambiguity regarding the exact version of > the code to be reviewed. This is true for both Joy's and Peter's > submissions: > * Joy's email provides a link to a Github repo, but does not specify > a particular commit (or even branch) in that repo: [2] > * In the email thread, Peter did provide a patch set: [3] > but the corresponding commitfest entry references a github branch: [4] Well, at the point we're at here, it's probably not that important exactly which version of a patchset you're looking at; I'd take the latest. > Q4) Do we require that any submitted patches appear as attachments on > the pgsql-hackers email list, or is a github URL good enough? Actually, we *do* require that, mainly as a formality to show that the author intended to submit it for inclusion in Postgres. (We don't want people coming back later and saying "hey, you ripped off this code from my github repo without my permission".) If we were seriously considering adopting Joy's version then that would have to happen before anything got merged. But at this point it seems like we're in a very exploratory phase and there's no need for legal niceties yet. > Q5) (This question is more generic.) I'm accustomed to using Github's > pull-request system, where I can engage in dialog regarding specifc > lines of a patch. I haven't noticed anything similar being used for > PG code reviews, but perhaps I'm just looking in the wrong places. > Are all PG code reviews basically just back-and-forth email > conversations on the pgsql-hackers list? Yup, that's how we roll ... it's ancient habit from before there was such a thing as git, let alone github, but we've not seen fit to change. It does have the advantage that it's about equally amenable to high- level discussions and line-by-line issues. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From christian.convey@gmail.com Sat Sep 10 22:20:25 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1biqdN-0002do-7g for pgsql-hackers@arkaria.postgresql.org; Sat, 10 Sep 2016 22:20:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1biqdM-0004Ez-R0 for pgsql-hackers@arkaria.postgresql.org; Sat, 10 Sep 2016 22:20:24 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1biqdL-0004DY-SU for pgsql-hackers@postgresql.org; Sat, 10 Sep 2016 22:20:23 +0000 Received: from mail-qk0-x233.google.com ([2607:f8b0:400d:c09::233]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1biqdI-00043f-Ht for pgsql-hackers@postgresql.org; Sat, 10 Sep 2016 22:20:23 +0000 Received: by mail-qk0-x233.google.com with SMTP id z190so100707746qkc.3 for ; Sat, 10 Sep 2016 15:20:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=2YkGPwsXh7y3peNUZejT0BPJnIIwdEWBQ1HkuGBjDnQ=; b=0mUUfGUwibF11DqEXH+MUf03duq1SJuYX+nb/sKg9un+Tn9V+Q8FbzhyARxUeQNwih uuPY0LyHeqqvs3eeSvV7pOwCzmz1r3cI8cB4mdjZj6JTD7YeaRZ1+KfgSz7x9ppv1piC BiwybrW5kwgY54E5jZJ2JBtPLrvee2vfkpGN1NXKDvtF6UXyHteg8eHo1GABN+w0m2+Y i0KKBC27SSDPP7lXejFZ1wIrHlPxL/wjBpu62D4SCjeWsljoTcks2AfRdsLTQ8d7jF8E 2211S3ue//8trrPXccixPSlN2ilsY+QRBq84cU13vhK9Z5L6ssMk0mNqI9m2F0yblq1d 1JSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=2YkGPwsXh7y3peNUZejT0BPJnIIwdEWBQ1HkuGBjDnQ=; b=gL7sx7xhmwcIlXPR6kQBa6H50ynH/v8Iov0QcOwzyLfS+V6SyEM0saQFbygpVvgLgh G/OU/ygqSwkSj2S5ErOpZkUPy79h7FOY+RAooEXINWilI1YJUHc3XxVREVOVe3xRac24 IK+u5CI59o63ZOxrN2AInqrBeV+yEvnt5G1/Rp03G7yJOpXAEucRlaszNe65JdCbm+a4 tZ/la7YCS/uUBLkrauJAbRmackpnPaNaxQX+3KzYp1CKO461aY9w2cJp6AGmtmgD9uJT 2whgy2iBDYu5NRswJ35AiezMsxn1xaPZ5wcLPd++ijUoWc8lF//5BFSPlnIH/Km9zFJQ O+sQ== X-Gm-Message-State: AE9vXwPzTL2Qq8arI9xe7U3yOsD6b3lgQL0TGPH6/QSTzUTfMNY1dcA1Py+IcGhg2J084bn8vsRc95z3BTQz7Q== X-Received: by 10.55.221.209 with SMTP id u78mr11165380qku.224.1473546018921; Sat, 10 Sep 2016 15:20:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.141.131 with HTTP; Sat, 10 Sep 2016 15:20:17 -0700 (PDT) In-Reply-To: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> <14459.1473189179@sss.pgh.pa.us> From: Christian Convey Date: Sat, 10 Sep 2016 18:20:17 -0400 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Heikki Linnakangas Cc: Pg Hackers Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Hi Heikki, Could I ask you a newbie-reviewer question about something I'm seeing here? https://commitfest.postgresql.org/10/776/ From christian.convey@gmail.com Sun Sep 11 13:49:45 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bj58j-0004YB-I6 for pgsql-general@arkaria.postgresql.org; Sun, 11 Sep 2016 13:49:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bj58i-0002lw-IK for pgsql-general@arkaria.postgresql.org; Sun, 11 Sep 2016 13:49:44 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bj56Q-00007r-0i for pgsql-general@postgresql.org; Sun, 11 Sep 2016 13:47:22 +0000 Received: from mail-qt0-x22c.google.com ([2607:f8b0:400d:c0d::22c]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bj56I-0003Os-Ew for pgsql-general@postgresql.org; Sun, 11 Sep 2016 13:47:21 +0000 Received: by mail-qt0-x22c.google.com with SMTP id 38so61769256qte.1 for ; Sun, 11 Sep 2016 06:47:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=/KMEQpCewgyEdwplWvnifRCDujzUZAbsiwcPqOVDwYQ=; b=Iv/Xi9OoXgQQVXVX9NHLNc8sZUp05p0OPHIO9GTDwaXZ7Sw+LT8gw6QWMdzC9VIW4Q e2kgmPLEgfIpyPAd88KVGQcnlUroqBypxUBizHREYrmoNflTPPvOjvgtKvUgsvolrRRd UfitdVvr/Fj+tMHUFPq7ARq8DlGktXAit/yAQtUDMiiwLThIfNraNoJ/ZyCZQf8cZ0B1 u7YA9w5dPEY1L7k4NAw00toGg4kyez4NL0f1G/iiizAhs7/I9S80hZtJiCTWIAU1439b eU+k6/KE6vPNKzsc9WY/OtJaei6Ws8HgtZgoM3FV7EYAnRq0oRXBHunKSBJ8iXgdLO2l KvVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=/KMEQpCewgyEdwplWvnifRCDujzUZAbsiwcPqOVDwYQ=; b=iym2sLBVELkIUHpi0S5y//+ZB0hEck3XHk+EF8UZVs9+3neqo9KpzaOGsUlIe0jAic 0Sz88OtVxNd545R1xKAIVqHtDs7VGcUZTtNGC+abExJFEIVheSFNc+ru1mBb0lE/QZEZ BpI7ThKWyhfsTZb0ltDWfxwWlTIoHvHF4Ksx28PUOrCvSNKcQ4TgVJFWIS3pwNbedTID ssgL7psrrMFiClxQ+Em46pmP49jGJcOTIgiT/hTUBw1niul5e70iqxrt6GQ67kxnR4pC HjPMl47hkfA2Ju56moXPs96c6q191jj6Bsldaq4E6iHDMJLe1I8xyXrQQaf7CH8EM5h0 9ArQ== X-Gm-Message-State: AE9vXwO1SsEjwQmY+mMOg5ibXqlrxI13g9FeeaOVWEERDV4O71ADa87cPo/qwgSW1IX56HsqlmU7kq1nQ4NAMQ== X-Received: by 10.200.49.81 with SMTP id h17mr6311263qtb.48.1473601631863; Sun, 11 Sep 2016 06:47:11 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.141.131 with HTTP; Sun, 11 Sep 2016 06:47:10 -0700 (PDT) In-Reply-To: References: From: Christian Convey Date: Sun, 11 Sep 2016 09:47:10 -0400 Message-ID: Subject: Re: C++ port of Postgres To: Joy Arulraj Cc: pgsql-general@postgresql.org Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org On Sun, Aug 14, 2016 at 5:05 PM, Joy Arulraj wrote: > Hi folks -- > > We have ported Postgres over to the C++ language (C++11 standard). > > https://github.com/jarulraj/postgresql-cpp > > Our goal is to use certain features of the C++ language and its standard > library to simplify coding, improve code reuse, and avoid bugs. Peter's > article titled `Moving to C++` was a source of inspiration for us. Do you remember the particular commit of PG upon which you based this work? Or even better, are you able to post a patch which applies cleanly to PG's current HEAD? I ask because I'd like to compare your approach to the one Peter has posted, and I think that will be easier if I can use a common (or at least similar) baseline for the comparison. Kind regards, Christian -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general From hlinnaka@iki.fi Sun Sep 11 14:12:47 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bj5V0-0005So-U8 for pgsql-hackers@arkaria.postgresql.org; Sun, 11 Sep 2016 14:12:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bj5V0-0005ML-Gf for pgsql-hackers@arkaria.postgresql.org; Sun, 11 Sep 2016 14:12:46 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bj5TZ-0003QP-91 for pgsql-hackers@postgresql.org; Sun, 11 Sep 2016 14:11:17 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bj5TS-0001ST-1L for pgsql-hackers@postgresql.org; Sun, 11 Sep 2016 14:11:15 +0000 Received: by mail-wm0-x242.google.com with SMTP id a6so9915910wmc.2 for ; Sun, 11 Sep 2016 07:11:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=3aLe+n2+KhnIpINPMiTKOeWuVOdRPD2RBOH8VDaFAX0=; b=NFbhA3ZQ5D1Remv3qQu2Ia1p687dkmjf720ZRVetyn+1Ze4vFUvanoawT4nPRID/f8 nDsKEMQnJpsqQyYrs6qfWM7XyxsapZ4frjow8BXpY+577HXRasLZ98wJ+7YA31YUj5It cgSDsJ8JonBuJBwDmCY00CLF+l6cXbrwtK9iXiu1bvEoO0e4oyVmAXgCxJxzXxEnlKJT YBYOZQMFRP+GgaaGqP7DPGVbTndqT9sLDfAPnChn8Ojc1gx1uRlrbh1BN02MBPTS6BqG 2gBXp6ItU6EzY9AxVQqUa8Bb8KMq7LsQc1bHKHHKkwB3DFzQR5673eGWi6sqzsefLgcM Qhxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=3aLe+n2+KhnIpINPMiTKOeWuVOdRPD2RBOH8VDaFAX0=; b=AuODBZz2q9LIihhVf5UyzuoxC1ZAuMXWap1eQ5powdcx5XiZrXfX/vCJ+tmF44Dqlx LbE1/xkS5g4/UC5SGB7EnRQ07MrXgeykjsSF5edvQioqe9MvRDKJZC36SxPLhTNjpdrY vM8ODlmSCXXYfyB8lv5RaTG/pPytTmPiKB6ha47LhLqgslXoyOrfod1dBXRtKmqbjf74 l14rPW/jglK7AOSEpsc+wmsa694FfzgasLq710ycMK3Nj+0h4YNS7vTXOkR4zTzq4duh /ZYFRVALGIgNcH7HU0ZwDQATo9VjWhpL3egEZvXw48YC128/l7wGPlrtNK5Q+NBn3BQt 181g== X-Gm-Message-State: AE9vXwPMXr/EjhQG/fl3g5qGQsBZTW4CM4V8zFwaquXyEW6HXoK3U3d15ADguHb6UgPYIg== X-Received: by 10.194.20.167 with SMTP id o7mr11039871wje.70.1473603066676; Sun, 11 Sep 2016 07:11:06 -0700 (PDT) Received: from [192.168.1.111] (dsl-hkibrasgw1-58c38f-82.dhcp.inet.fi. [88.195.143.82]) by smtp.gmail.com with ESMTPSA id ex14sm13112539wjc.30.2016.09.11.07.11.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Sep 2016 07:11:05 -0700 (PDT) Subject: Re: [GENERAL] C++ port of Postgres To: Christian Convey References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> <14459.1473189179@sss.pgh.pa.us> Cc: Pg Hackers From: Heikki Linnakangas Message-ID: Date: Sun, 11 Sep 2016 17:11:04 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 09/11/2016 01:20 AM, Christian Convey wrote: > Hi Heikki, > > Could I ask you a newbie-reviewer question about something I'm seeing > here? https://commitfest.postgresql.org/10/776/ > > From some reading I've done (e.g., Stephen Frost's PGCon 2011 slides), > I got the impression that a successful patch would always have this > sequence of states in commitfest: > 1. patch-record created > ... > 2. Needs Review > ... > 3. Ready for Committer > > But if I'm reading the patch's activity log correctly, it looks like > you marked the patch as "Ready for Committer" (2016-09-06 18:59:02) > without any record of it having been reviewed. > > Was that intentional? Yeah, I commented on the patches at https://www.postgresql.org/message-id/e8e7e5a7-0308-2c36-d32a-7aab16ba498c%40iki.fi. It was very cursory, but I figured that would be sufficient feedback for now, for Peter to proceed with the first few straightforward patches in the series. I don't think there's consensus that we want to do more than that, to actually switch to C++. > P.S. I'm asking because I was planning to review that patch. But I > can't tell if any more review by a non-committer is still required by > the commitfest workflow. I think this has gotten enough attention, for the commitfest workflow. But of course, if you're interested, feel free to review and comment anyway! - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From hlinnaka@iki.fi Sun Sep 11 14:12:26 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bj5Ug-0005SG-M9 for pgsql-hackers@arkaria.postgresql.org; Sun, 11 Sep 2016 14:12:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bj5Uf-0004cP-JF for pgsql-hackers@arkaria.postgresql.org; Sun, 11 Sep 2016 14:12:25 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bj5Ue-0004b9-Qe for pgsql-hackers@postgresql.org; Sun, 11 Sep 2016 14:12:24 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bj5UY-0003ot-65 for pgsql-hackers@postgresql.org; Sun, 11 Sep 2016 14:12:24 +0000 Received: by mail-wm0-x242.google.com with SMTP id d7so2204666wmi.3 for ; Sun, 11 Sep 2016 07:12:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=Kxc3WONxGO103QtCB0ByQrGIEz4ekMyPdGxv3wf0fxk=; b=EbbIgo38I9Dww7q5oMcTDdFp2tccrokY17Sw2xwtNPtLkNp3bHyt4Ij5wEAOMSd8Iz D58n4mGISwmamvh5PYDUkjMnaEsn89ODYpsxpJb2rgCAFkR+l9jWut99XnCKIAZxkELz 18lr2Av7faCj9reHFytUs4EmUJeCtuIM9ciGJXmZYnQTBGVmeA3cf51RRdelFka2e6QD hgUmtz/mmcgpBJHw6v2q4komNxisnAdxbi9Vz3qAmiAXkshipwNfCCbkluP+R4pymK/t HLQwRJwlIt1d54LVi5i5hPOjvhTwftTvK54IA/HvoYWWXM8gpAizKy/InkgdyipQqw8l A+cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=Kxc3WONxGO103QtCB0ByQrGIEz4ekMyPdGxv3wf0fxk=; b=iz+kZTMPm61/n4ov4Q4OCBG5XUd8n7ijkEql7X+wg/eLY8bURC/yWBEvXfA9zojqQ4 ca2Lf63AyxKE7SsdgwJqNMhX51QXch2m4hjvnDo5E4DUsT1fjrADaFMna7t3mJOTdksE 5B//FqYNvSNuhPToVKK8+u6RMGb4/SqR+t/LJ8n/9ssUvnSG4KeWks9rdrxN5qu9k6y2 bp7rXAucyu85W4N9jFZcUm50HKAcFMGrN7Nfgzdq5S0Q6hCpvNiYhuqnzc6OLETecUJV vpG5lH379rLfX9E3st847oHJSxpZE4A9fk0hBEvoYJL9Gw6UIKCPuC3U8n0Hkzgx5nnV zrxw== X-Gm-Message-State: AE9vXwM8iIzc/c8QllxLs7IhFTlP3UpllVWAhTXFDnwDCVFcExKXddLySeObol2Q5K4Chw== X-Received: by 10.194.95.36 with SMTP id dh4mr10933772wjb.156.1473603135978; Sun, 11 Sep 2016 07:12:15 -0700 (PDT) Received: from [192.168.1.111] (dsl-hkibrasgw1-58c38f-82.dhcp.inet.fi. [88.195.143.82]) by smtp.gmail.com with ESMTPSA id z17sm13082598wmz.23.2016.09.11.07.12.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Sep 2016 07:12:15 -0700 (PDT) Subject: Re: [GENERAL] C++ port of Postgres To: Christian Convey References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> <14459.1473189179@sss.pgh.pa.us> Cc: Pg Hackers From: Heikki Linnakangas Message-ID: <258e7455-3ed5-1e6b-ec77-37583855a536@iki.fi> Date: Sun, 11 Sep 2016 17:12:14 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 09/11/2016 01:20 AM, Christian Convey wrote: > Hi Heikki, > > Could I ask you a newbie-reviewer question about something I'm seeing > here? https://commitfest.postgresql.org/10/776/ > > From some reading I've done (e.g., Stephen Frost's PGCon 2011 slides), > I got the impression that a successful patch would always have this > sequence of states in commitfest: > 1. patch-record created > ... > 2. Needs Review > ... > 3. Ready for Committer > > But if I'm reading the patch's activity log correctly, it looks like > you marked the patch as "Ready for Committer" (2016-09-06 18:59:02) > without any record of it having been reviewed. > > Was that intentional? Yeah, I commented on the patches at https://www.postgresql.org/message-id/e8e7e5a7-0308-2c36-d32a-7aab16ba498c%40iki.fi. It was very cursory, but I figured that would be sufficient feedback for now, for Peter to proceed with the first few straightforward patches in the series. I don't think there's consensus that we want to do more than that, to actually switch to C++. > P.S. I'm asking because I was planning to review that patch. But I > can't tell if any more review by a non-committer is still required by > the commitfest workflow. I think this has gotten enough attention, for the commitfest workflow. The workflow is flexible, depending on the nature of patch. But of course, if you're interested, feel free to review and comment anyway! - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From christian.convey@gmail.com Sun Sep 11 14:26:45 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bj5iX-0005zM-KO for pgsql-hackers@arkaria.postgresql.org; Sun, 11 Sep 2016 14:26:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bj5iW-00072x-ID for pgsql-hackers@arkaria.postgresql.org; Sun, 11 Sep 2016 14:26:44 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bj5iU-00072e-JN for pgsql-hackers@postgresql.org; Sun, 11 Sep 2016 14:26:42 +0000 Received: from mail-qt0-x22a.google.com ([2607:f8b0:400d:c0d::22a]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bj5iG-0001j4-V9 for pgsql-hackers@postgresql.org; Sun, 11 Sep 2016 14:26:41 +0000 Received: by mail-qt0-x22a.google.com with SMTP id 93so61987514qtg.2 for ; Sun, 11 Sep 2016 07:26:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=FgdzE7Dq7DC/lb0Z4FJl7Bym+j/NGffqCFYtyG1n3QU=; b=k5lhu8GNiZAeHoCg+OYyXg5bDa9ukY1kkVVyUyLJNZeJXb7zjE9P8Xo4CsswI7ie2n 0vBqX8I7XLjlJbx0lJs5ppkoH6pRFq6GzPXQSDwtd7LQACDf3Kz3BFvdqpVFg+ISRvWR D/ekPpZUKFj4pQnjmJcSOF3CdjBK9gXUauHkdxO/QE9nT3p06Ei+j4uK7RYfrdbCzTx/ NeYUjuaOuBhKP3eEIJdrMAyHtYtNzE1Meuar0X/JPn10cEAolrk+yNTDVgJZgse6EAIJ /SC7dSqR/Rb+/FsY07iQ6ipOuqWxeOKGSystSJTfFGWfJZzd6x3vgEaH651lQwfUnuFV BhDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=FgdzE7Dq7DC/lb0Z4FJl7Bym+j/NGffqCFYtyG1n3QU=; b=ENnoHP1iu14L7xiGukSusRPshMbvRmu8TVJvrvYfeUwfwXB9TuG+mAKYEBAG+0EfJw WT1OJpGqEAPcTQckFbTw4Eh/XJ4TVWM1yzcBRNRKD/toFQiZPpgn5Z4W+lLZ+ety2mzp WrLiTCIZZkansYPRVZvsETOmIOMLc8DxTucNbwhG5/bAzdpwnmaAGOjeL92IygoRc34V Va415fUCMOWzPJFvZRbutFIdjYttdmN/oAjiGPQc/HuqyDUm+tbbWFMVOe3Y7RpNqC9g i9VgAT/glcBuRbNJFNJ2CIcpSASOE/N5u9o8QQqIiv8hbRXNutGU049YP3OB5qBEIUef 1mJA== X-Gm-Message-State: AE9vXwMRRGHrmbrNsotn0WFIVdz0GavZ+/St1/VMuvyiCbesp0Af6FP8AduittQ6LyVn8QkA7eCcPh6GTddS8A== X-Received: by 10.237.44.66 with SMTP id f60mr14740574qtd.11.1473603987557; Sun, 11 Sep 2016 07:26:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.141.131 with HTTP; Sun, 11 Sep 2016 07:26:25 -0700 (PDT) In-Reply-To: <258e7455-3ed5-1e6b-ec77-37583855a536@iki.fi> References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> <14459.1473189179@sss.pgh.pa.us> <258e7455-3ed5-1e6b-ec77-37583855a536@iki.fi> From: Christian Convey Date: Sun, 11 Sep 2016 10:26:25 -0400 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Heikki Linnakangas Cc: Pg Hackers Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org > P.S. I'm asking because I was planning to review that patch. But I >> can't tell if any more review by a non-committer is still required by >> the commitfest workflow. > > > I think this has gotten enough attention, for the commitfest workflow. The > workflow is flexible, depending on the nature of patch. But of course, if > you're interested, feel free to review and comment anyway! Hi Heikki, Thanks for the help. If you think nothing more is needed for this patch set w.r.t. the 2016-09 commitfest, I'll move on to other things. - Christian -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From christian.convey@gmail.com Sun Sep 11 16:35:00 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bj7ie-0002Ra-0q for pgsql-hackers@arkaria.postgresql.org; Sun, 11 Sep 2016 16:35:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bj7id-0001uF-66 for pgsql-hackers@arkaria.postgresql.org; Sun, 11 Sep 2016 16:34:59 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bj7ib-0001tI-On for pgsql-hackers@postgresql.org; Sun, 11 Sep 2016 16:34:57 +0000 Received: from mail-qk0-x22b.google.com ([2607:f8b0:400d:c09::22b]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bj7iU-0003vv-9w for pgsql-hackers@postgresql.org; Sun, 11 Sep 2016 16:34:56 +0000 Received: by mail-qk0-x22b.google.com with SMTP id z190so111863846qkc.3 for ; Sun, 11 Sep 2016 09:34:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=sjXlUnV95X83qo8irJmpk+hhuBaSJSrmQNi9eorENBg=; b=kL1yKGHXJTYTVRvtAoXwsFa7gVrIIg9fZTTF+YSiWQrwkbuDLK4stUpc/5sQn7d6xt Hr8NWtsn4Y+Sv/XOzMX1/E6CnTlRWfpPK9Zh1ZxcxzslTJDBq52ZyZENfKCIVn3Lq56P g2SuLTD+BN4YoLZeqlL5h/1Lt5S9QssBcBJud+hCCSXHB7gi5cWyZjv9/kPuvlMuKJ7B yXgpZybxfKaSWYdDlvodm9/sAODv8EtM0auAujeK6plIwtQdx/ES2zK8CSVLNTVpoAh1 yiczfUZs2QQWvhJRXB+/muZ7VwMcdOwf46pFGCr/CjZGUuimCXDMJuDqKI/C58Utwn1j yzOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=sjXlUnV95X83qo8irJmpk+hhuBaSJSrmQNi9eorENBg=; b=GZHwQ5raV76Go0+WEBIbVjyhm31yEumBw4tdepjU4GnDnVaANJuBnXu4+d471ue58V ktzmx1P98D659baKDhO3Bb6+kilW4pO/QTVaJUquiHb57tZO4pVLtzqACRxNKpMl1ewI xmrw+sQgCjxuNz+6UeL+rZtDCmbpg4mAbFTYlUTjWlejSGM/ztau+GTv6OZ+4m1NB+8N Ff2trxeIEObsB7SsaY3Kd6HUxVKADp9G+Db25i8qjyJhE4eAipiPy9IU0sqcEZ1c0Gip ozjm2ziTaQhQsJ+60TV0asoDKJEDRdU79trjbHAPMOA5wBgDZ7cKSWvcE0sKj83tFtTR tmvw== X-Gm-Message-State: AE9vXwMnTVP5MSfTNkS+d3X8hX86/XZTRMd1uxyrrf6e8DpWO38K8ZCTxXiJPi4ocNh4PxXkEb9VtUcEn7KFLw== X-Received: by 10.55.87.135 with SMTP id l129mr15991756qkb.0.1473611689118; Sun, 11 Sep 2016 09:34:49 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.141.131 with HTTP; Sun, 11 Sep 2016 09:34:47 -0700 (PDT) In-Reply-To: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> From: Christian Convey Date: Sun, 11 Sep 2016 12:34:47 -0400 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Peter Eisentraut Cc: Pg Hackers Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Some of your patches look useful, but unrelated to C++: 7, 8, 15, 16(?), 20. I applied that subset to 9.6 and got a clean "make check". Would it make sense to add them to the next commitfest, regardless of the C++ effort? On Wed, Aug 31, 2016 at 9:41 AM, Peter Eisentraut wrote: > [trimmed cc list because of big attachments] > > On 8/16/16 4:22 PM, Jim Nasby wrote: >> Joy, do you have an idea what a *minimally invasive* patch for C++ >> support would look like? That's certainly the first step here. > > I developed a minimally invasive patch for C++ support a few years ago > shortly after I wrote that blog post. Since there appears to have been > some interest here now, I have updated that and split it up into logical > chunks. > > So here you go. > > To build this, you need to configure with g++ <= version 5. (4.x works, > too.) g++ version 6 does not work yet because of the issues described > in patch 0013. > > Then you also need to edit src/Makefile.custom and set > > COPT = -fpermissive -Wno-sign-compare -Wno-write-strings > > The -W options are optional just to reduce some noise. Cleaning up > those warnings can be a separate project that might also have some > benefit under C. > > The -fpermissive option is a g++ specific option that reduces some > errors to warnings. (So this won't work with clang or other compilers > at all at this point.) In particular, C++ does not allow casting from > or to void pointers without a cast, but -fpermissive allows that. The > step from this to "real" C++ would be adding a bunch of casts around > things like malloc and palloc and other places. That would be mostly > busy work, so I have excluded that here. > > The patches are numbered approximately in increasing order of dubiosity. > So 0001 is probably a straight bug fix, 0002 and 0003 are arguably > minor bug fixes as well. The patches through 0012 can probably be > considered for committing in some form. After that it gets a bit hackish. > > -- > Peter Eisentraut http://www.2ndQuadrant.com/ > PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services > > > -- > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-hackers > -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From jarulraj@cs.cmu.edu Fri Sep 23 23:40:01 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bna4W-0002s6-V3 for pgsql-general@arkaria.postgresql.org; Fri, 23 Sep 2016 23:40:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bna4W-0004gT-D5 for pgsql-general@arkaria.postgresql.org; Fri, 23 Sep 2016 23:40:00 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bna2C-00025V-JP for pgsql-general@postgresql.org; Fri, 23 Sep 2016 23:37:36 +0000 Received: from smtp02.srv.cs.cmu.edu ([128.2.217.201]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bna27-0001Oj-Sa for pgsql-general@postgresql.org; Fri, 23 Sep 2016 23:37:34 +0000 Received-SPF: none (cs.cmu.edu: No applicable sender policy available) receiver=smtp02.srv.cs.cmu.edu; identity=mailfrom; envelope-from="jarulraj@cs.cmu.edu"; helo=mail-vk0-f52.google.com; client-ip=209.85.213.52 Received: from mail-vk0-f52.google.com (mail-vk0-f52.google.com [209.85.213.52]) (authenticated bits=0) by smtp02.srv.cs.cmu.edu (8.13.6/8.13.6) with ESMTP id u8NNbSwG001329 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Fri, 23 Sep 2016 19:37:29 -0400 (EDT) Received: by mail-vk0-f52.google.com with SMTP id d8so3969915vka.3 for ; Fri, 23 Sep 2016 16:37:28 -0700 (PDT) X-Gm-Message-State: AA6/9Rl5pVj9uj5IUWY0NatCa0EUlML0kFzsZ1Po6KuxVZPimreVPOEtPq7x4q8nY/0jzgCb25zkgI8yZN/7Lg== X-Received: by 10.31.47.70 with SMTP id v67mr668647vkv.4.1474673848133; Fri, 23 Sep 2016 16:37:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.4.15 with HTTP; Fri, 23 Sep 2016 16:37:07 -0700 (PDT) In-Reply-To: References: From: Joy Arulraj Date: Fri, 23 Sep 2016 16:37:07 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: C++ port of Postgres To: Christian Convey Cc: pgsql-general@postgresql.org Content-Type: multipart/alternative; boundary=001a1143ebc2e0b09f053d354265 X-Scanned-By: mimedefang-cmuscs on 128.2.217.201 X-Pg-Spam-Score: -7.3 (-------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org --001a1143ebc2e0b09f053d354265 Content-Type: text/plain; charset=UTF-8 Hi Christian -- Sorry about the delay. The patch is based on PG version 9.5.3. The commit history of the repo should give a high-level idea of the changes required in PG to support compilation by a C++ compiler. I presume that Peter's patch would be easier to integrate into PG. In any case, I would be very glad to see PostgreSQL support C++. Regards. On Sun, Sep 11, 2016 at 6:47 AM, Christian Convey < christian.convey@gmail.com> wrote: > On Sun, Aug 14, 2016 at 5:05 PM, Joy Arulraj wrote: > > Hi folks -- > > > > We have ported Postgres over to the C++ language (C++11 standard). > > > > https://github.com/jarulraj/postgresql-cpp > > > > Our goal is to use certain features of the C++ language and its standard > > library to simplify coding, improve code reuse, and avoid bugs. Peter's > > article titled `Moving to C++` was a source of inspiration for us. > > Do you remember the particular commit of PG upon which you based this > work? Or even better, are you able to post a patch which applies > cleanly to PG's current HEAD? > > I ask because I'd like to compare your approach to the one Peter has > posted, and I think that will be easier if I can use a common (or at > least similar) baseline for the comparison. > > Kind regards, > Christian > --001a1143ebc2e0b09f053d354265 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Christian -- Sorry about the delay. The patch is based = on PG version 9.5.3.
The commit history of the repo should give a high-= level idea of the changes=C2=A0
required in PG to support compila= tion by a C++ compiler. I presume that=C2=A0
Peter's patch wo= uld be easier to integrate into PG. In any case, I would be=C2=A0
very glad to see PostgreSQL support C++.=C2=A0

Re= gards.

=
On Sun, Sep 11, 2016 at 6:47 AM, Christian= Convey <christian.convey@gmail.com> wrote:
On Sun= , Aug 14, 2016 at 5:05 PM, Joy Arulraj <jarulraj@cs.cmu.edu> wrote:
> Hi folks --
>
> We have ported Postgres over to the C++ language (C++11 standard).
>
> https://github.com/jarulraj/postgresql-cpp >
> Our goal is to use certain features of the C++ language and its standa= rd
> library to simplify coding, improve code reuse, and avoid bugs. Peter&= #39;s
> article titled `Moving to C++` was a source of inspiration for us.

Do you remember the particular commit of PG upon which you based thi= s
work?=C2=A0 Or even better, are you able to post a patch which applies
cleanly to PG's current HEAD?

I ask because I'd like to compare your approach to the one Peter has posted, and I think that will be easier if I can use a common (or at
least similar) baseline for the comparison.

Kind regards,
Christian

--001a1143ebc2e0b09f053d354265-- From thomas.munro@enterprisedb.com Sun Sep 25 21:57:25 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1boHQL-0008Cr-EC for pgsql-hackers@arkaria.postgresql.org; Sun, 25 Sep 2016 21:57:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1boHQK-0007am-Fq for pgsql-hackers@arkaria.postgresql.org; Sun, 25 Sep 2016 21:57:24 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1boHQI-0007aB-RN for pgsql-hackers@postgresql.org; Sun, 25 Sep 2016 21:57:23 +0000 Received: from mail-vk0-x235.google.com ([2607:f8b0:400c:c05::235]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1boHQF-0000fU-2Z for pgsql-hackers@postgresql.org; Sun, 25 Sep 2016 21:57:21 +0000 Received: by mail-vk0-x235.google.com with SMTP id d8so30669686vka.3 for ; Sun, 25 Sep 2016 14:57:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=wRv7+FdemM8V/8nlumxxu3MHT3A+4U3ssbU5cpMNYbY=; b=ghuyaoUVRPWBSpDsvNcDrDI2iGGUgMHQuUClQQRfQ5lAgA9jLKw5Hmms4H1rkjaUe4 tDYw4NSDOORkDsxTz2lIeXkcH8LKXC9skBFF6L/5MPmjQUlTj5/uUyITGCUZi8ILVXh/ GBVQ6+/8WcqNVOfb89MceLy1PPChkhIg3jCtV0mzEgSjaSieNqxW43uwuvJvwsoY1RwS Fli/qFjielro3NjtUGH4vIHSYlOOqTxAJ+OXQmoeI6w5qZVVVGXu4ZFklzxJphBqJulo lF8xyUuCSBQsM8G43NANdSApt66X0hCwqPCgrRocHFiruyFZP3G1rUrYN8TYNgIzyG6Q 6btw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=wRv7+FdemM8V/8nlumxxu3MHT3A+4U3ssbU5cpMNYbY=; b=f1qJ11zVKF/6idIK4uDatYA+4qNZ61rAD6HsFW0BBYl7KDxvYMPTagQcbdZzeQx25F 9F68t+p+SXUQMoYgJ+mCBwWRRL+Ul9MxEiY4oNTIIjSxpcB2FcYKWkzMRUW2IJZ6O7qS WeYRWdO+xk5QAyaJ0aRn92NQjtHPBzUzOLJQzbXzUNv2/quFzXyA9e076pdtS7lYTyHn /CMgtMq7GAwNVm6DNIc0C2uiaLx8a/fJhywSfJOxu4xOzgKOVy5nxRlnu9capitNbfmN L8Jr+G5wqEYv5tomF5STLeT4jymxCIp+jTC3PuAdSvQcEzKijBNXWnhcR9NbHxgMls61 Y7lg== X-Gm-Message-State: AA6/9RmtSrPfVrTlbKSxL+sXICLh9qOQBUqUlidaD702LB4Z5ffPlGyNlh9eZ2kvVJES1Ore/K5u/ICRwMJERUXB X-Received: by 10.31.79.134 with SMTP id d128mr5960059vkb.109.1474840637690; Sun, 25 Sep 2016 14:57:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.237.4 with HTTP; Sun, 25 Sep 2016 14:57:16 -0700 (PDT) In-Reply-To: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> From: Thomas Munro Date: Mon, 26 Sep 2016 10:57:16 +1300 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Peter Eisentraut Cc: Pg Hackers , Jim Nasby Content-Type: multipart/alternative; boundary=001a114d9cf24f6b66053d5c18a3 X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --001a114d9cf24f6b66053d5c18a3 Content-Type: text/plain; charset=UTF-8 On Thu, Sep 1, 2016 at 1:41 AM, Peter Eisentraut < peter.eisentraut@2ndquadrant.com> wrote: > [trimmed cc list because of big attachments] > > On 8/16/16 4:22 PM, Jim Nasby wrote: > > Joy, do you have an idea what a *minimally invasive* patch for C++ > > support would look like? That's certainly the first step here. > > I developed a minimally invasive patch for C++ support a few years ago > shortly after I wrote that blog post. Since there appears to have been > some interest here now, I have updated that and split it up into logical > chunks. > > So here you go. > I looked at a random selection of these patches this morning. > 0001-Fix-use-of-offsetof.patch I agree that this is already invalid C because it's not constant. It is accepted by GCC's C front end no matter what switches you give it and clearly many other compilers too, but not clang's C front end with "-pedantic". > 0002-Use-return-instead-of-exit-in-configure.patch Makes sense. Any reason not to #include instead like you did for the 0003 patch? > 0003-Add-missing-include-files-to-configure-tests.patch Makes sense. > 0014-Set-up-for-static-asserts-in-C.patch +#if __cpp_static_assert >= 201411 +#define _Static_assert(condition, errmessage) static_assert(condition, errmessage) Don't you mean 201103L? C++11 introduced two-argument static_assert, not C++14. > 0021-Workaround-for-using-typdef-ed-ints-in-loops.patch > > Types made from int don't have a ++ operator in C++, so they can't be > used in for loops without further work. ForkNumber is not a typedef'd int: it's an enum. Since it's called a "fork *number*" and clearly treated as a number in various places including loops that want to increment it, perhaps it really should be a typedef of an int, instead of an enum. Then either macros or an enum ForkNumberEnum could define the names (you can assign enums to ints, and compare enums and ints, you just can't assign ints to enums so it'd be no problem to have typedef ForkNumber int and then enum ForkNumberEnum { ... } to define the friendly names, but never actually use the type ForkNumberEnum). > 0023-Add-C-linkage-to-replacement-declaration-of-fdatasyn.patch -extern int fdatasync(int fildes); +extern "C" int fdatasync(int fildes); Doesn't this need to be made conditional on __cplusplus? > 0024-Make-inet_net_-to-C-linkage.patch Same. > 0025-Add-C-linkage-to-functions-exported-by-plugins.patch -extern void _PG_init(void); +extern "C" void _PG_init(void); Why this way in some places... +extern "C" { extern void _PG_init(void); +} ... and this way in single-function declaration cases in other places? -char *widget_out(WIDGET *widget); +char *widget_out(WIDGET * widget); Noise. > 0027-Hack-Disable-volatile-that-causes-mysterious-compile.patch > > Subject: [PATCH 27/27] Hack: Disable volatile that causes mysterious compiler errors I don't grok the reason for the volatile qualifier in this code the first place but if it actually does something useful, here's one way to fix it. The specific reason for the error reported by GCC is that QueuePosition (a struct) is copied by assignment: pos = oldpos = QUEUE_BACKEND_POS(MyBackendId); That means that it invokes the default assignment operator, and you can't do that with a volatile and a non-volatile object either way around according to C++ (though clang seems less fussy than GCC in this case). You could try to untangle that by supplying a suitably qualified explicit member operator: #ifdef __cplusplus QueuePosition& operator=(const volatile QueuePosition& other) { page = other.page; offset = other.offset; return *this; } #endif But that doesn't help with assignments going the other way.... How about just defining a macro in the style of the existing macros and then using that in place of all those incompatible assignment operations: iff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index 716f1c3..469018f 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -194,6 +194,12 @@ typedef struct QueuePosition (x).offset = (z); \ } while (0) +#define COPY_QUEUE_POS(x, y) \ + do { \ + (x).page = (y).page; \ + (x).offset = (y).offset; \ + } while (0) + #define QUEUE_POS_EQUAL(x,y) \ ((x).page == (y).page && (x).offset == (y).offset) @@ -1757,7 +1763,8 @@ asyncQueueReadAllNotifications(void) LWLockAcquire(AsyncQueueLock, LW_SHARED); /* Assert checks that we have a valid state entry */ Assert(MyProcPid == QUEUE_BACKEND_PID(MyBackendId)); - pos = oldpos = QUEUE_BACKEND_POS(MyBackendId); + COPY_QUEUE_POS(pos, QUEUE_BACKEND_POS(MyBackendId)); + COPY_QUEUE_POS(oldpos, pos); head = QUEUE_HEAD; LWLockRelease(AsyncQueueLock); @@ -1861,7 +1868,7 @@ asyncQueueReadAllNotifications(void) { /* Update shared state */ LWLockAcquire(AsyncQueueLock, LW_SHARED); - QUEUE_BACKEND_POS(MyBackendId) = pos; + COPY_QUEUE_POS(QUEUE_BACKEND_POS(MyBackendId), pos); advanceTail = QUEUE_POS_EQUAL(oldpos, QUEUE_TAIL); LWLockRelease(AsyncQueueLock); @@ -1875,7 +1882,7 @@ asyncQueueReadAllNotifications(void) /* Update shared state */ LWLockAcquire(AsyncQueueLock, LW_SHARED); - QUEUE_BACKEND_POS(MyBackendId) = pos; + COPY_QUEUE_POS(QUEUE_BACKEND_POS(MyBackendId), pos); advanceTail = QUEUE_POS_EQUAL(oldpos, QUEUE_TAIL); LWLockRelease(AsyncQueueLock); @@ -1911,7 +1918,9 @@ asyncQueueProcessPageEntries(volatile QueuePosition *current, do { - QueuePosition thisentry = *current; + QueuePosition thisentry; + + COPY_QUEUE_POS(thisentry, *current); if (QUEUE_POS_EQUAL(thisentry, stop)) break; @@ -1944,7 +1953,7 @@ asyncQueueProcessPageEntries(volatile QueuePosition *current, * from a transaction that is not yet visible to snapshots; * compare the comments at the head of tqual.c. */ - *current = thisentry; + COPY_QUEUE_POS(*current, thisentry); reachedStop = true; break; } -- Thomas Munro http://www.enterprisedb.com --001a114d9cf24f6b66053d5c18a3 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On T= hu, Sep 1, 2016 at 1:41 AM, Peter Eisentraut <peter.eisent= raut@2ndquadrant.com> wrote:
[trimmed cc list because of big attachments]

On 8/16/16 4:22 PM, Jim Nasby wrote:
> Joy, do you have an idea what a *minimally invasive* patch for C++
> support would look like? That's certainly the first step here.

I developed a minimally invasive patch for C++ support a few years a= go
shortly after I wrote that blog post.=C2=A0 Since there appears to have bee= n
some interest here now, I have updated that and split it up into logical chunks.

So here you go.

I looked at a random selectio= n of these patches this morning.

> 0001-Fix-use= -of-offsetof.patch

I agree that this is already in= valid C because it's not constant.=C2=A0 It is accepted by GCC's C = front end no matter what switches you give it and clearly many other compil= ers too, but not clang's C front end with "-pedantic".
<= div>
> 0002-Use-return-instead-of-exit-in-configure.patch<= /div>

Makes sense.=C2=A0 Any reason not to #include <= stdlib.h> instead like you did for the 0003 patch?

<= div>> 0003-Add-missing-include-files-to-configure-tests.patch
=
Makes sense.

> 0014-Set-up-for-s= tatic-asserts-in-C.patch

+#if __cpp_static_assert = >=3D 201411
+#define _Static_assert(condition, errmessage) sta= tic_assert(condition, errmessage)

Don't you me= an 201103L?=C2=A0 C++11 introduced two-argument static_assert, not C++14.

> 0021-Workaround-for-using-typdef-ed-ints-in-lo= ops.patch
>
> Types made from int don't have = a ++ operator in C++, so they can't be
> used in for loops= without further work.

ForkNumber is not a typedef= 'd int: it's an enum.=C2=A0 Since it's called a "fork *num= ber*" and clearly treated as a number in various places including loop= s that want to increment it, perhaps it really should be a typedef of an in= t, instead of an enum.=C2=A0 Then either macros or an enum ForkNumberEnum c= ould define the names (you can assign enums to ints, and compare enums and = ints, you just can't assign ints to enums so it'd be no problem to = have typedef ForkNumber int and then enum ForkNumberEnum { ... } to define = the friendly names, but never actually use the type ForkNumberEnum).
<= div>
> 0023-Add-C-linkage-to-replacement-declaration-of-fd= atasyn.patch

-extern int fdatasync(int fildes);
+extern "C" int fdatasync(int fildes);

Doe= sn't this need to be made conditional on __cplusplus?

> 0024-Make-inet_net_-to-C-linkage.patch

Same.

> 0025-Add-C-linkage-to-functions-expor= ted-by-plugins.patch

-extern void _PG_init(void);<= /div>
+extern "C" void _PG_init(void);

Why this way in some places...

+extern "C&= quot; {
=C2=A0extern void _PG_init(void);
+}
=
... and this way in single-function declaration cases in oth= er places?

-char =C2=A0 *widget_out(WIDGET *widget);
+char =C2=A0 *widget_out(WIDGET * widget);

No= ise.

> 0027-Hack-Disable-volatile-that-causes-m= ysterious-compile.patch
>
>=C2=A0Subject: [PATCH 27/27] Hack: Disable volatil= e that causes mysterious compiler errors
I don't grok the reason for the volatile qualifier in= this code the first place but if it actually does something useful, here&#= 39;s one way to fix it.=C2=A0 The specific reason for the error reported by= GCC is that QueuePosition (a struct) is copied by assignment:
=C2=A0 pos =3D oldpos =3D QUEUE_BACKEND_POS(MyBackendId);

That means that it invokes the default assignment oper= ator, and you can't do that with a volatile and a non-volatile object e= ither way around according to C++ (though clang seems less fussy than GCC i= n this case).=C2=A0 You could try to untangle that by supplying a suitably = qualified explicit member operator:

#ifdef __cplus= plus =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0
=C2=A0 =C2=A0 QueuePosition& operator=3D(const volatile QueuePo= sition& other) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
=C2=A0 =C2=A0 { =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 page =3D other.page; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0=C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 offset =3D other.offset; = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0=C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return *th= is; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
=C2= =A0 =C2=A0 } =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
#endif =C2=A0

But that doesn't help with assignments going the= other way....=C2=A0 How about just defining a macro in the style of the ex= isting macros and then using that in place of all those incompatible assign= ment operations:

iff --git a/src/backend/commands/= async.c b/src/backend/commands/async.c
index 716f1c3..469018f 100= 644
--- a/src/backend/commands/async.c
+++ b/src/backen= d/commands/async.c
@@ -194,6 +194,12 @@ typedef struct QueuePosit= ion
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (x).o= ffset =3D (z); \
=C2=A0 =C2=A0 =C2=A0 =C2=A0 } while (0)
=C2=A0
+#define COPY_QUEUE_POS(x, y) \
+ =C2=A0 =C2= =A0 =C2=A0 do { \
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (x).page =3D (y).page; \
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 (x).offset =3D (y).offset; \
+ =C2=A0 =C2=A0 =C2= =A0 } while (0)
+
=C2=A0#define QUEUE_POS_EQUAL(x,y) \<= /div>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0((x).page =3D=3D (y).page &= & (x).offset =3D=3D (y).offset)
=C2=A0
@@ -1757,7 += 1763,8 @@ asyncQueueReadAllNotifications(void)
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 LWLockAcquire(AsyncQueueLock, LW_SHARED);
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 /* Assert checks that we have a valid state entry */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Assert(MyProcPid =3D=3D QUEUE_BACKEND_PID= (MyBackendId));
- =C2=A0 =C2=A0 =C2=A0 pos =3D oldpos =3D QUEUE_B= ACKEND_POS(MyBackendId);
+ =C2=A0 =C2=A0 =C2=A0 COPY_QUEUE_POS(po= s, QUEUE_BACKEND_POS(MyBackendId));
+ =C2=A0 =C2=A0 =C2=A0 COPY_Q= UEUE_POS(oldpos, pos);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 head =3D QUEUE= _HEAD;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 LWLockRelease(AsyncQueueLock);=
=C2=A0
@@ -1861,7 +1868,7 @@ asyncQueueReadAllNotifica= tions(void)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {
=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Update shared state */
<= div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 LWLockAcquire(A= syncQueueLock, LW_SHARED);
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 QUEUE_BACKEND_POS(MyBackendId) =3D pos;
+ =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 COPY_QUEUE_POS(QUEUE_BACKEND_POS(= MyBackendId), pos);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 advanceTail =3D QUEUE_POS_EQUAL(oldpos, QUEUE_TAIL);
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 LWLockRelease(Async= QueueLock);
=C2=A0
@@ -1875,7 +1882,7 @@ asyncQueueRead= AllNotifications(void)
=C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 /* Update shared state */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 LWLockA= cquire(AsyncQueueLock, LW_SHARED);
- =C2=A0 =C2=A0 =C2=A0 QUEUE_B= ACKEND_POS(MyBackendId) =3D pos;
+ =C2=A0 =C2=A0 =C2=A0 COPY_QUEU= E_POS(QUEUE_BACKEND_POS(MyBackendId), pos);
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 advanceTail =3D QUEUE_POS_EQUAL(oldpos, QUEUE_TAIL);
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 LWLockRelease(AsyncQueueLock);
=C2=A0
@@ -1911,7 +1918,9 @@ asyncQueueProcessPageEntries(volatile QueuePo= sition *current,
=C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 do<= /div>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 {
- =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 QueuePosition thisentry =3D *current;
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 QueuePosition thisentry= ;
+
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = COPY_QUEUE_POS(thisentry, *current);
=C2=A0
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (QUEUE_POS_EQUAL(thisentry= , stop))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;
@@ -1944,7 +1953,7 @@ asyncQue= ueProcessPageEntries(volatile QueuePosition *current,
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* from a transaction that is not yet visi= ble to snapshots;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* = compare the comments at the head of tqual.c.
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0*/
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *curr= ent =3D thisentry;
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 COPY_QUEUE_P= OS(*current, thisentry);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 r= eachedStop =3D true;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break= ;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 }=C2=A0


--
--001a114d9cf24f6b66053d5c18a3-- From thomas.munro@enterprisedb.com Thu Sep 29 02:49:00 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpRP9-0003IU-P3 for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Sep 2016 02:49:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bpRP9-0005tb-BZ for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Sep 2016 02:48:59 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bpRP7-0005qM-Ge for pgsql-hackers@postgresql.org; Thu, 29 Sep 2016 02:48:57 +0000 Received: from mail-ua0-x22b.google.com ([2607:f8b0:400c:c08::22b]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bpROy-0008Pl-3K for pgsql-hackers@postgresql.org; Thu, 29 Sep 2016 02:48:56 +0000 Received: by mail-ua0-x22b.google.com with SMTP id q42so54453273uaq.2 for ; Wed, 28 Sep 2016 19:48:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=/irdsLVSaCk4KJRKY2JQjxlWgD2gw2xMkD/HAwOFKuQ=; b=KTJBooPavxC7YF35yuD/+qwYA1KF1rPmtfWyb/mwnpkU3AUfqsFVlm6Q2RKmzXLSnA 7ocjhy5xRB/FrRkY0PaKqFD28P5ujIijfyAag1VOi8+VwDyb5CPzhf70g21W17LKASIn /hOaq7av6Xa5DkBVsieuCRqvgk1kHizLGZ/FBI0+IifLsMuCTtBVm292AfZnCxBBA9sE lrsJ/d2OIOVm0ZQQ58RwhHvvuXBEj3w7GtIPETzCSHWVle3do7EnfQlx8Ixhv44nEhvE aJMXsFLlbQT7dhHl9CZRaH92VudO0YXe+iBimPyAe8/ofYqV0iFN76zftnHuoaZwi01F UkVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=/irdsLVSaCk4KJRKY2JQjxlWgD2gw2xMkD/HAwOFKuQ=; b=jbpcmXBqB/uPSTPHQsMhOuyhcVOsQt0FVdiK6wvoUH0r3A6WbHXKfDMhKyOj2sGNWO E5XiksW+a+getI5Y0BzfOxfVe198sxLLx7LUPZaxu/7QfwceDPZvIyp9BfHCGqkOAeqi RlMeWu+VVySX8rKyxeKdNvbYj2e45pC/LZo+IAZr6UeIanZFF3lDp5e2U54X+FRHMaci S4xQpDYM08yZFCgcbnzF0hc952qBqufQEWurrE/JHP4QNjxfZ9ncYVHyjdwKQUPA9ovQ Y6UnIXL3IYxa1YtSyAXs6ce20+ps/ShzqYf8/mWB5ttZ5nn1dfZUE8vK/uRO2StfwkDe DpQg== X-Gm-Message-State: AA6/9RlDiGtu+1bIl0lQZQAd+gsbwGuASjHFHf63MeMjaxlI/3mILF9ORydlE0ShKVIeJUBF9df4TjgfJujAZS5J X-Received: by 10.159.35.47 with SMTP id 44mr8700488uae.46.1475117326003; Wed, 28 Sep 2016 19:48:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.85.194 with HTTP; Wed, 28 Sep 2016 19:48:45 -0700 (PDT) In-Reply-To: References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> From: Thomas Munro Date: Thu, 29 Sep 2016 15:48:45 +1300 Message-ID: Subject: Re: [GENERAL] C++ port of Postgres To: Peter Eisentraut Cc: Pg Hackers , Jim Nasby Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Mon, Sep 26, 2016 at 10:57 AM, Thomas Munro wrote: > On Thu, Sep 1, 2016 at 1:41 AM, Peter Eisentraut > wrote: >> >> [trimmed cc list because of big attachments] >> >> On 8/16/16 4:22 PM, Jim Nasby wrote: >> > Joy, do you have an idea what a *minimally invasive* patch for C++ >> > support would look like? That's certainly the first step here. >> >> I developed a minimally invasive patch for C++ support a few years ago >> shortly after I wrote that blog post. Since there appears to have been >> some interest here now, I have updated that and split it up into logical >> chunks. >> >> So here you go. > > > I looked at a random selection of these patches this morning. And this morning I looked at the rest of them. > 0004-Fix-LDFLAGS-test-for-C.patch Makes sense. > 0005-Add-test-for-Wmissing-prototypes.patch This does seem to follow the example of how we test for support for other warning flags. > 0006-Remove-unnecessary-prototypes.patch Looks OK. > 0007-Fix-incorrect-type-cast.patch /* array of check flags, reported to consistentFn */ - bool *entryRes; + GinTernaryValue *entryRes; Right. That would be pretty dodgy even in C if we ever use stdbool.h, because sizeof(_Bool) is implementation defined. The interchangeability relies on bool and GinTernaryValue both being typedefs for 'char'. (Not to mention the dangerous contradictions possible with bools obtained that way: 'b == false || b == true' can be false, which I guess has been thought about already and is off topic here.) I wonder if the following bit of gin.h should be more nuanced: maybe it's OK to convert between bool and GinTernaryValue, but it's definitely not OK to cast between pointers types? Or maybe we should have a function/macro to convert between the types explicitly and not encourage people to consider them convertible. /* * A ternary value used by tri-consistent functions. * * For convenience, this is compatible with booleans. A boolean can be * safely cast to a GinTernaryValue. */ typedef char GinTernaryValue; > 0008-Add-necessary-type-cast.patch Maybe instead of this: - gcv.check = check; + gcv.check = (GinTernaryValue *) check; ... it would be better to do this? - bool *check = (bool *) PG_GETARG_POINTER(0); + GinTernaryValue *check = (GinTernaryValue *) PG_GETARG_POINTER(0); > 0009-Rename-some-typedefs-to-avoid-name-conflicts.patch I don't know if it's a relevant precedent or not, but I noticed that fdwapi.h, amapi.h and tsmapi.h used the convention that function pointer types are named XXX_function, and then the members of a struct behaving as a kind of vtable are named XXX. > 0010-Reorder-some-things.patch > Forward declarations of static variables are not possible in C++, so > move the full definition before its use. Right. > 0011-Add-missing-fields-in-struct-initializations.patch I don't undestand why this is necessary, unless you're explicitly choosing to enable a warning like missing-field-initializers for C++ but not for C. Implicit zero-initialisation of trailing missing initialisers is a feature, not a bug. Also I noticed that 0013 (or a proper solution to the keyword collision problem) is needed before this one. > 0012-Separate-enum-from-struct.patch Right. > 0013-Avoid-C-key-words.patch > This is not a long-term solution, because C header files that are > included somewhere might have C++ awareness and will break if the key > word is defined away. But this shows the list of words that would have > to be renamed around the code. Right, let's rename them all directly. > 0015-Fix-function-prototypes-for-C.patch I wonder if (perhaps in some later later patch) walkers should take const pointers and mutators non-const. That may require propagating constness around some more places. > 0017-Don-t-define-bool-in-C.patch Check. > 0018-Change-TimeoutId-from-enum-to-integer.patch This works, but I feel like we're losing something valuable if we convert all our enums to ints just because some tiny bit of code somewhere wants to loop over them. Maybe we should we keep enums like this, and do the necessary casting in the small number of places that do int-like-stuff with them? Like so: diff --git a/src/backend/utils/misc/timeout.c b/src/backend/utils/misc/timeout.c index 7171a7c..cc5b2c4 100644 --- a/src/backend/utils/misc/timeout.c +++ b/src/backend/utils/misc/timeout.c @@ -348,7 +348,7 @@ InitializeTimeouts(void) for (i = 0; i < MAX_TIMEOUTS; i++) { - all_timeouts[i].index = i; + all_timeouts[i].index = (TimeoutId) i; all_timeouts[i].indicator = false; all_timeouts[i].timeout_handler = NULL; all_timeouts[i].start_time = 0; @@ -379,7 +379,8 @@ RegisterTimeout(TimeoutId id, timeout_handler_proc handler) if (id >= USER_TIMEOUT) { /* Allocate a user-defined timeout reason */ - for (id = USER_TIMEOUT; id < MAX_TIMEOUTS; id++) + for (id = USER_TIMEOUT; id < MAX_TIMEOUTS; + id = (TimeoutId) ((int) id + 1)) if (all_timeouts[id].timeout_handler == NULL) break; if (id >= MAX_TIMEOUTS) > 0019-Add-explicit-cast-for-casting-away-volatile.patch - tmp = e->counters; + tmp = const_cast(e)->counters; Obviously we can't just drop C++ casts in here like that. Casting away volatile might in theory produce the wrong result in some cases, but we can see that there is a compiler barrier right there already (included in the preceding SpinLockAcquire) so I guess we could do a C-style cast to lose volatile so it remains a valid C program: - tmp = e->counters; + tmp = ((pgssEntry *) e)->counters; > 0020-Add-more-extern-key-words.patch Don't we just need to put declarations in a header included by guc.c and the defining transation unit, or explicitly duplicate the declarations in both (including the one that defines it immediately after)? Then we would have valid C and C++ with the right linkage. That is, instead of this: -const struct config_enum_entry wal_level_options[] = { +extern const struct config_enum_entry wal_level_options[] = { {"minimal", WAL_LEVEL_MINIMAL, false}, {"replica", WAL_LEVEL_REPLICA, false}, {"archive", WAL_LEVEL_REPLICA, true}, /* deprecated */ ... we would do this: +extern const struct config_enum_entry wal_level_options[]; const struct config_enum_entry wal_level_options[] = { {"minimal", WAL_LEVEL_MINIMAL, false}, {"replica", WAL_LEVEL_REPLICA, false}, {"archive", WAL_LEVEL_REPLICA, true}, /* deprecated */ > 0022-Disable-conflicting-function.patch > This function conflicts with a function in the backend. FIXME Indeed: $ git grep ^xml_is_well_formed\( contrib/xml2/xpath.c:xml_is_well_formed(PG_FUNCTION_ARGS) src/backend/utils/adt/xml.c:xml_is_well_formed(PG_FUNCTION_ARGS) The contrib one says: /* * Returns true if document is well-formed * * Note: this has been superseded by a core function. We still have to * have it in the contrib module so that existing SQL-level references * to the function won't fail; but in normal usage with up-to-date SQL * definitions for the contrib module, this won't be called. */ It's been in core since 9.1, ie in every supported version. I'm not sure what the comment means exactly but I wonder: can we just delete the contrib version now? As for the commitfest entry: this thread discusses two different people's efforts to compile PostgreSQL as C++. Joy Arulraj's github branch derives in some way from Peter Eisentraut's work, but I have provided feedback on Peter's patches, because (1) they were posted here in patch format and (2) there is a commitfest entry listening Peter as the author. I think several of these patches are committable, and many obviously are not. Heikki already set the CF item to 'Ready for Committer' based on an inspection of a few of the patches, but invited others to continue looking, so I did. -- Thomas Munro http://www.enterprisedb.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From peter.eisentraut@2ndquadrant.com Fri Sep 30 19:15:35 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bq3HT-0007hf-A1 for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Sep 2016 19:15:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bq3HS-00018U-R7 for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Sep 2016 19:15:34 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bq3HS-000180-2O for pgsql-hackers@postgresql.org; Fri, 30 Sep 2016 19:15:34 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bq3HP-0002qE-IK for pgsql-hackers@postgresql.org; Fri, 30 Sep 2016 19:15:32 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 93A6820638; Fri, 30 Sep 2016 15:15:30 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Fri, 30 Sep 2016 15:15:30 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=ySYfxR9nrkNExn4 n5pfIbnGcVC0=; b=b16RvD2wB0NJoAvcl2RNDfDYlyfc2bFSxTa8QQyDUNvgsz+ njxTnPUEDQA4snpq88g0Fx5D7AKZfpBL7GVqNA25ePuwucvC5Zoytm98ojSScTAd Q+DwQIZXxNmlXVQiJYauxzvt5hUZ2MqNg+YMP2NuknYqJ5EbfwJhkS/t1gc4= X-Sasl-enc: wVRbMRW9MlXv6tcppnk1WUMegiUbn3cGumJidSSx0HMS 1475262930 Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id 37EFBCC080; Fri, 30 Sep 2016 15:15:30 -0400 (EDT) Subject: Re: [GENERAL] C++ port of Postgres To: Heikki Linnakangas , Pg Hackers References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> Cc: Jim Nasby From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <117edb9c-1ddd-9305-8946-82c6ff63ac20@2ndquadrant.com> Date: Fri, 30 Sep 2016 15:15:29 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 9/6/16 2:58 PM, Heikki Linnakangas wrote: > 0001-0003 look clear to me as well. 0006 - 0009 also seem OK. The rest > really only make sense if we decided to make the switch to C++. I have committed 0001, 0002, 0003, 0006, as well as 0012. Thomas Munro had some interesting comments on 0007-0009 that are worth considering further. The rest of the patches will be kept around for future amusement. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From peter.eisentraut@2ndquadrant.com Fri Sep 30 19:24:19 2016 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bq3Pv-0000D6-ET for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Sep 2016 19:24:19 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bq3Pv-0007YA-0z for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Sep 2016 19:24:19 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bq3Pp-0007UC-RD for pgsql-hackers@postgresql.org; Fri, 30 Sep 2016 19:24:13 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bq3Pm-0002wv-Ut for pgsql-hackers@postgresql.org; Fri, 30 Sep 2016 19:24:12 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 3E52920A07; Fri, 30 Sep 2016 15:24:10 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Fri, 30 Sep 2016 15:24:10 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=U2jNTX41XX+HZlZ tAxZ5JI/Ois0=; b=RXlZi+etXoMFDNBoubL7qQeikdlhOt8IFc+O6FthqSKeZIU e+Ale7nbC2/F6nZxq32msrDC6sn9puaEyupATcqo53wmz9W3bCzcSAnp27jxynqG 1kpVxBq0Qc2lqsC+tSxO7XqvnWmU29qe/yy7wHwIBTGvYi55/GSKwgrYN/54= X-Sasl-enc: A2g3iwZ29vJHGN+OELCanFd5bw5pXsqmrk5tkD1DAry4 1475263450 Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id EB3E5CC083; Fri, 30 Sep 2016 15:24:09 -0400 (EDT) Subject: Re: [GENERAL] C++ port of Postgres To: Thomas Munro References: <007001d1f786$d903fa90$8b0befb0$@andl.org> <00a52208-3199-5858-8846-2530b0bb34df@archidevsys.co.nz> <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> Cc: Pg Hackers , Jim Nasby From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <6703fdf2-d0e8-54f5-333a-19220d9a716a@2ndquadrant.com> Date: Fri, 30 Sep 2016 15:24:09 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 9/28/16 10:48 PM, Thomas Munro wrote: > I wonder if the following bit of gin.h should be more nuanced: maybe > it's OK to convert between bool and GinTernaryValue, but it's > definitely not OK to cast between pointers types? Or maybe we should > have a function/macro to convert between the types explicitly and not > encourage people to consider them convertible. The more I look into the this, the more this looks like a web of lies. :-) The GIN consistent and triconsistent functions randomly change around between bool and GinTernaryValue, share some of the same data structures, and there is little guarantee that they each get the right kind of value all the time. This could perhaps use some deeper cleaning at some point. I've left that alone for now. >> 0009-Rename-some-typedefs-to-avoid-name-conflicts.patch > > I don't know if it's a relevant precedent or not, but I noticed that > fdwapi.h, amapi.h and tsmapi.h used the convention that function > pointer types are named XXX_function, and then the members of a struct > behaving as a kind of vtable are named XXX. Good idea, and that also overlaps with some other stuff I have wanted to tidy up in pg_dump, so I might get back to that later. >> 0011-Add-missing-fields-in-struct-initializations.patch > > I don't undestand why this is necessary, unless you're explicitly > choosing to enable a warning like missing-field-initializers for C++ > but not for C. I can't reproduce this anymore, so never mind. > As for the commitfest entry: this thread discusses two different > people's efforts to compile PostgreSQL as C++. Joy Arulraj's github > branch derives in some way from Peter Eisentraut's work, but I have > provided feedback on Peter's patches, because (1) they were posted > here in patch format and (2) there is a commitfest entry listening > Peter as the author. I think several of these patches are > committable, and many obviously are not. Heikki already set the CF > item to 'Ready for Committer' based on an inspection of a few of the > patches, but invited others to continue looking, so I did. Yeah, I have committed a few of the patches now and I'll close the CF entry now. Thanks for your research. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From andres@anarazel.de Fri Jan 27 03:46:36 2017 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cWxUi-0000ba-On for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Jan 2017 03:46:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cWxUg-0001w7-Eq for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Jan 2017 03:46:34 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cWxUe-0001vF-US for pgsql-hackers@postgresql.org; Fri, 27 Jan 2017 03:46:32 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cWxUb-0002TJ-RK for pgsql-hackers@postgresql.org; Fri, 27 Jan 2017 03:46:32 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 058F020958; Thu, 26 Jan 2017 22:46:28 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Thu, 26 Jan 2017 22:46:28 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=uYw0LFAkOdjPNX +4DIj8GjSdKQs=; b=es6yz4mMS/5Yq5F+O8x9Oufdkth0/EYwfOr8Se0sn/X1Qc QrzcCxxvpypKs8RJfcwDeVRiM55CalRUFl9KEIT1CURIq/IP8RLDfH8BUIiQ+aOO Jqya2EGyeZFBdVym7LO9sEdj/AybT5W1PWYeTWO73D0tct2ADKpM8Nj7TcuQo= X-ME-Sender: X-Sasl-enc: ueS6NTw7CgeaRX7A/xlj2PJfXxQFqjb6Vq9zkFoFgdFP 1485488787 Received: from intern.anarazel.de (unknown [199.87.86.247]) by mail.messagingengine.com (Postfix) with ESMTPA id BF48E7E1D1; Thu, 26 Jan 2017 22:46:27 -0500 (EST) Date: Thu, 26 Jan 2017 19:46:26 -0800 From: Andres Freund To: Peter Eisentraut Cc: Thomas Munro , Pg Hackers , Jim Nasby Subject: Re: [GENERAL] C++ port of Postgres Message-ID: <20170127034626.frvkfy66hsq3734v@alap3.anarazel.de> References: <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> <6703fdf2-d0e8-54f5-333a-19220d9a716a@2ndquadrant.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6703fdf2-d0e8-54f5-333a-19220d9a716a@2ndquadrant.com> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Hi Peter, On 2016-09-30 15:24:09 -0400, Peter Eisentraut wrote: > Yeah, I have committed a few of the patches now and I'll close the CF > entry now. Thanks for your research. Are you planning to push more of these at some point? - Andres -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From peter.eisentraut@2ndquadrant.com Wed Mar 1 13:46:21 2017 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cj4aC-0006z2-S3 for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Mar 2017 13:46:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cj4aA-0005DY-VR for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Mar 2017 13:46:19 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ciw6V-0007Ki-4A for pgsql-hackers@postgresql.org; Wed, 01 Mar 2017 04:43:07 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ciw6C-0003c7-8F for pgsql-hackers@postgresql.org; Wed, 01 Mar 2017 04:43:06 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 9FC3A2074D; Tue, 28 Feb 2017 23:42:46 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Tue, 28 Feb 2017 23:42:46 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=SgZc8VlE6bFOCh M+IZasITBrDFE=; b=ga57KQfM4D5AfkLPnwggYBPEoNWUzSK1fZacTX82HaQ1Kv Re1xxkyGEHFdx/6MvXuFJKPmJrN0dsw54BBvZk3UJ0qpasaKPwPrfIxgv9oLTSPh psQQsz7Ax1ZEzExe6IzGDXKWWw9ARx1WrCBinwd9d1S9OhQgfrzQKtSDcUY9A= X-ME-Sender: X-Sasl-enc: gD4blRkDYvByWg6NrCmeQDHZywMY1z+DDhGTr9zVlS98 1488343365 Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id 84F2F240CE; Tue, 28 Feb 2017 23:42:45 -0500 (EST) Subject: Re: [GENERAL] C++ port of Postgres To: Andres Freund References: <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> <6703fdf2-d0e8-54f5-333a-19220d9a716a@2ndquadrant.com> <20170127034626.frvkfy66hsq3734v@alap3.anarazel.de> Cc: Thomas Munro , Pg Hackers , Jim Nasby From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <1570c7ca-72e4-7839-29e4-5b30c5d150b4@2ndquadrant.com> Date: Tue, 28 Feb 2017 23:42:45 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170127034626.frvkfy66hsq3734v@alap3.anarazel.de> Content-Type: multipart/mixed; boundary="------------8B20B2E58236AE0A3510A841" X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org This is a multi-part message in MIME format. --------------8B20B2E58236AE0A3510A841 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit On 1/26/17 22:46, Andres Freund wrote: > On 2016-09-30 15:24:09 -0400, Peter Eisentraut wrote: >> Yeah, I have committed a few of the patches now and I'll close the CF >> entry now. Thanks for your research. > > Are you planning to push more of these at some point? Sure, let's take a look. Here are rebased patches. It now contains a patch that removes all C++ keywords, instead of just defining them away. With that, this now builds with g++-6 (formerly only g++-5), and with that, the static_assert support works as well. Interesting patches to review would be: v2-0001-Fix-mixup-of-bool-and-ternary-value.patch v2-0004-Add-necessary-type-cast.patch v2-0005-Rename-some-typedefs-to-avoid-name-conflicts.patch v2-0007-Eliminate-C-keywords.patch v2-0023-Fix-issue-with-enums-and-va_arg.patch The rest are mostly for amusement. Getting rid of the C++ keywords would open up the possibility of using -Wc++-compat, which you have expressed interest in, I think. I think it also increases clarity in some cases in its own right, so it's worth taking a look. (Then again, there are some rush jobs in there, as well.) (This semi-bug was found while preparing these patches: https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=eb75f4fced77e108393f18425ec3f7aba2e70a9d) -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0001-Fix-mixup-of-bool-and-ternary-value.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="v2-0001-Fix-mixup-of-bool-and-ternary-value.patch" =46rom 041c259a35d37c097191dbdfef3e7268b01dac26 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 01/23] Fix mixup of bool and ternary value --- src/backend/access/gin/ginscan.c | 2 +- src/include/access/gin_private.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/access/gin/ginscan.c b/src/backend/access/gin/gins= can.c index c3ce0479c5..c83375d6b4 100644 --- a/src/backend/access/gin/ginscan.c +++ b/src/backend/access/gin/ginscan.c @@ -147,7 +147,7 @@ ginFillScanKey(GinScanOpaque so, OffsetNumber attnum, key->nuserentries =3D nUserQueryValues; =20 key->scanEntry =3D (GinScanEntry *) palloc(sizeof(GinScanEntry) * nQueryV= alues); - key->entryRes =3D (bool *) palloc0(sizeof(bool) * nQueryValues); + key->entryRes =3D (GinTernaryValue *) palloc0(sizeof(GinTernaryValue) * n= QueryValues); =20 key->query =3D query; key->queryValues =3D queryValues; diff --git a/src/include/access/gin_private.h b/src/include/access/gin_priv= ate.h index 34e7339f05..f1f395ac85 100644 --- a/src/include/access/gin_private.h +++ b/src/include/access/gin_private.h @@ -281,7 +281,7 @@ typedef struct GinScanKeyData int nadditional; =20 /* array of check flags, reported to consistentFn */ - bool *entryRes; + GinTernaryValue *entryRes; bool (*boolConsistentFn) (GinScanKey key); GinTernaryValue (*triConsistentFn) (GinScanKey key); FmgrInfo *consistentFmgrInfo; --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0002-Fix-LDFLAGS-test-for-C.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="v2-0002-Fix-LDFLAGS-test-for-C.patch" =46rom 7c2f4f31df0eec816d6bb17aa6df2e7f3c6da03e Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 02/23] Fix LDFLAGS test for C++ The test looks to link to particular function, so we need to make that function have C linkage. --- config/c-compiler.m4 | 9 ++++++++- configure | 27 ++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 index 7d901e1f1a..21fb4645c4 100644 --- a/config/c-compiler.m4 +++ b/config/c-compiler.m4 @@ -353,7 +353,14 @@ AC_DEFUN([PGAC_PROG_CC_LDFLAGS_OPT], AC_CACHE_CHECK([whether $CC supports $1], [Ac_cachevar], [pgac_save_LDFLAGS=3D$LDFLAGS LDFLAGS=3D"$pgac_save_LDFLAGS $1" -AC_RUN_IFELSE([AC_LANG_PROGRAM([extern void $2 (); void (*fptr) () =3D $2;= ],[])], +AC_RUN_IFELSE([AC_LANG_PROGRAM([#ifdef __cplusplus +extern "C" { +#endif +extern void $2 (); +#ifdef __cplusplus +} +#endif +void (*fptr) () =3D $2;],[])], [Ac_cachevar=3Dyes], [Ac_cachevar=3Dno], [Ac_cachevar=3D"assuming no"]) diff --git a/configure b/configure index b5cdebb510..b1ad1ce838 100755 --- a/configure +++ b/configure @@ -16025,7 +16025,14 @@ if test "$cross_compiling" =3D yes; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern void $link_test_func (); void (*fptr) () =3D $link_test_func; +#ifdef __cplusplus +extern "C" { +#endif +extern void $link_test_func (); +#ifdef __cplusplus +} +#endif +void (*fptr) () =3D $link_test_func; int main () { @@ -16064,7 +16071,14 @@ if test "$cross_compiling" =3D yes; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern void $link_test_func (); void (*fptr) () =3D $link_test_func; +#ifdef __cplusplus +extern "C" { +#endif +extern void $link_test_func (); +#ifdef __cplusplus +} +#endif +void (*fptr) () =3D $link_test_func; int main () { @@ -16103,7 +16117,14 @@ if test "$cross_compiling" =3D yes; then : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -extern void $link_test_func (); void (*fptr) () =3D $link_test_func; +#ifdef __cplusplus +extern "C" { +#endif +extern void $link_test_func (); +#ifdef __cplusplus +} +#endif +void (*fptr) () =3D $link_test_func; int main () { --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0003-Add-test-for-Wmissing-prototypes.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="v2-0003-Add-test-for-Wmissing-prototypes.patch" =46rom fd5248ca63ce3cf35f22cebd2088c4dfd3d994a4 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 03/23] Add test for -Wmissing-prototypes This was part of the hard-coded default warnings set in C, but the option is not valid for C++ (since prototypes are always required). --- configure | 38 +++++++++++++++++++++++++++++++++++++- configure.in | 4 +++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/configure b/configure index b1ad1ce838..f0c5356e1f 100755 --- a/configure +++ b/configure @@ -4440,7 +4440,43 @@ fi # but has its own. Also check other compiler-specific flags here. =20 if test "$GCC" =3D yes -a "$ICC" =3D no; then - CFLAGS=3D"-Wall -Wmissing-prototypes -Wpointer-arith" + CFLAGS=3D"-Wall -Wpointer-arith" + # not valid for C++ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -= Wmissing-prototypes" >&5 +$as_echo_n "checking whether $CC supports -Wmissing-prototypes... " >&6; } +if ${pgac_cv_prog_cc_cflags__Wmissing_prototypes+:} false; then : + $as_echo_n "(cached) " >&6 +else + pgac_save_CFLAGS=3D$CFLAGS +CFLAGS=3D"$pgac_save_CFLAGS -Wmissing-prototypes" +ac_save_c_werror_flag=3D$ac_c_werror_flag +ac_c_werror_flag=3Dyes +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + pgac_cv_prog_cc_cflags__Wmissing_prototypes=3Dyes +else + pgac_cv_prog_cc_cflags__Wmissing_prototypes=3Dno +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_c_werror_flag=3D$ac_save_c_werror_flag +CFLAGS=3D"$pgac_save_CFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__= Wmissing_prototypes" >&5 +$as_echo "$pgac_cv_prog_cc_cflags__Wmissing_prototypes" >&6; } +if test x"$pgac_cv_prog_cc_cflags__Wmissing_prototypes" =3D x"yes"; then + CFLAGS=3D"$CFLAGS -Wmissing-prototypes" +fi + # These work in some but not all gcc versions { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -= Wdeclaration-after-statement" >&5 $as_echo_n "checking whether $CC supports -Wdeclaration-after-statement...= " >&6; } diff --git a/configure.in b/configure.in index 1d99cda1d8..8099e5c59f 100644 --- a/configure.in +++ b/configure.in @@ -445,7 +445,9 @@ fi # but has its own. Also check other compiler-specific flags here. =20 if test "$GCC" =3D yes -a "$ICC" =3D no; then - CFLAGS=3D"-Wall -Wmissing-prototypes -Wpointer-arith" + CFLAGS=3D"-Wall -Wpointer-arith" + # not valid for C++ + PGAC_PROG_CC_CFLAGS_OPT([-Wmissing-prototypes]) # These work in some but not all gcc versions PGAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement]) PGAC_PROG_CC_CFLAGS_OPT([-Wendif-labels]) --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0004-Add-necessary-type-cast.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="v2-0004-Add-necessary-type-cast.patch" =46rom 3447e7cc85c1f2836d882e19952e6db1950a2607 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 04/23] Add necessary type cast --- src/backend/utils/adt/tsginidx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/adt/tsginidx.c b/src/backend/utils/adt/tsgin= idx.c index 83a939dfd5..8f38972676 100644 --- a/src/backend/utils/adt/tsginidx.c +++ b/src/backend/utils/adt/tsginidx.c @@ -309,7 +309,7 @@ gin_tsquery_consistent(PG_FUNCTION_ARGS) * query. */ gcv.first_item =3D GETQUERY(query); - gcv.check =3D check; + gcv.check =3D (GinTernaryValue *) check; gcv.map_item_operand =3D (int *) (extra_data[0]); gcv.need_recheck =3D recheck; =20 --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0005-Rename-some-typedefs-to-avoid-name-conflicts.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="v2-0005-Rename-some-typedefs-to-avoid-name-conflicts.patch" =46rom db1807e62dd6ccf358132a7c56ede2531d33336f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 05/23] Rename some typedefs to avoid name conflicts C++ does not like that in struct _archiveHandle some of the fields have the same name as a typedef. This changes the meaning of the typedef in the scope of the struct, causing warnings and possibly other problems. Rename the types so they have names distinct from the struct fields. --- src/bin/pg_dump/pg_backup.h | 4 +- src/bin/pg_dump/pg_backup_archiver.c | 10 ++-- src/bin/pg_dump/pg_backup_archiver.h | 96 ++++++++++++++++++--------------= ---- 3 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h index 6480fb8e74..a6e84efc38 100644 --- a/src/bin/pg_dump/pg_backup.h +++ b/src/bin/pg_dump/pg_backup.h @@ -229,7 +229,7 @@ typedef int DumpId; =20 typedef int (*DataDumperPtr) (Archive *AH, void *userArg); =20 -typedef void (*SetupWorkerPtr) (Archive *AH); +typedef void (*SetupWorkerPtrType) (Archive *AH); =20 /* * Main archiver interface. @@ -276,7 +276,7 @@ extern Archive *OpenArchive(const char *FileSpec, const= ArchiveFormat fmt); /* Create a new archive */ extern Archive *CreateArchive(const char *FileSpec, const ArchiveFormat fm= t, const int compression, ArchiveMode mode, - SetupWorkerPtr setupDumpWorker); + SetupWorkerPtrType setupDumpWorker); =20 /* The --list option */ extern void PrintTOCSummary(Archive *AH); diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_back= up_archiver.c index 7e2bed38b3..e387293664 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -54,7 +54,7 @@ static const char *modulename =3D gettext_noop("archiver"= ); =20 =20 static ArchiveHandle *_allocAH(const char *FileSpec, const ArchiveFormat f= mt, - const int compression, ArchiveMode mode, SetupWorkerPtr setupWorkerPtr); + const int compression, ArchiveMode mode, SetupWorkerPtrType setupWorkerP= tr); static void _getObjectDescription(PQExpBuffer buf, TocEntry *te, ArchiveHandle *AH); static void _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData, b= ool acl_pass); @@ -202,7 +202,7 @@ setupRestoreWorker(Archive *AHX) /* Public */ Archive * CreateArchive(const char *FileSpec, const ArchiveFormat fmt, - const int compression, ArchiveMode mode, SetupWorkerPtr setupDumpWorker) + const int compression, ArchiveMode mode, SetupWorkerPtrType setupDumpWor= ker) =20 { ArchiveHandle *AH =3D _allocAH(FileSpec, fmt, compression, mode, setupDum= pWorker); @@ -2241,7 +2241,7 @@ _discoverArchiveFormat(ArchiveHandle *AH) */ static ArchiveHandle * _allocAH(const char *FileSpec, const ArchiveFormat fmt, - const int compression, ArchiveMode mode, SetupWorkerPtr setupWorkerPtr) + const int compression, ArchiveMode mode, SetupWorkerPtrType setupWorker= Ptr) { ArchiveHandle *AH; =20 @@ -2413,8 +2413,8 @@ mark_dump_job_done(ArchiveHandle *AH, void WriteDataChunksForTocEntry(ArchiveHandle *AH, TocEntry *te) { - StartDataPtr startPtr; - EndDataPtr endPtr; + StartDataPtrType startPtr; + EndDataPtrType endPtr; =20 AH->currToc =3D te; =20 diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_back= up_archiver.h index a44e16ee45..81f0db8d3c 100644 --- a/src/bin/pg_dump/pg_backup_archiver.h +++ b/src/bin/pg_dump/pg_backup_archiver.h @@ -143,36 +143,36 @@ typedef enum T_Action ACT_RESTORE } T_Action; =20 -typedef void (*ClosePtr) (ArchiveHandle *AH); -typedef void (*ReopenPtr) (ArchiveHandle *AH); -typedef void (*ArchiveEntryPtr) (ArchiveHandle *AH, TocEntry *te); +typedef void (*ClosePtrType) (ArchiveHandle *AH); +typedef void (*ReopenPtrType) (ArchiveHandle *AH); +typedef void (*ArchiveEntryPtrType) (ArchiveHandle *AH, TocEntry *te); =20 -typedef void (*StartDataPtr) (ArchiveHandle *AH, TocEntry *te); -typedef void (*WriteDataPtr) (ArchiveHandle *AH, const void *data, size_t = dLen); -typedef void (*EndDataPtr) (ArchiveHandle *AH, TocEntry *te); +typedef void (*StartDataPtrType) (ArchiveHandle *AH, TocEntry *te); +typedef void (*WriteDataPtrType) (ArchiveHandle *AH, const void *data, siz= e_t dLen); +typedef void (*EndDataPtrType) (ArchiveHandle *AH, TocEntry *te); =20 -typedef void (*StartBlobsPtr) (ArchiveHandle *AH, TocEntry *te); -typedef void (*StartBlobPtr) (ArchiveHandle *AH, TocEntry *te, Oid oid); -typedef void (*EndBlobPtr) (ArchiveHandle *AH, TocEntry *te, Oid oid); -typedef void (*EndBlobsPtr) (ArchiveHandle *AH, TocEntry *te); +typedef void (*StartBlobsPtrType) (ArchiveHandle *AH, TocEntry *te); +typedef void (*StartBlobPtrType) (ArchiveHandle *AH, TocEntry *te, Oid oid= ); +typedef void (*EndBlobPtrType) (ArchiveHandle *AH, TocEntry *te, Oid oid); +typedef void (*EndBlobsPtrType) (ArchiveHandle *AH, TocEntry *te); =20 -typedef int (*WriteBytePtr) (ArchiveHandle *AH, const int i); -typedef int (*ReadBytePtr) (ArchiveHandle *AH); -typedef void (*WriteBufPtr) (ArchiveHandle *AH, const void *c, size_t len); -typedef void (*ReadBufPtr) (ArchiveHandle *AH, void *buf, size_t len); -typedef void (*SaveArchivePtr) (ArchiveHandle *AH); -typedef void (*WriteExtraTocPtr) (ArchiveHandle *AH, TocEntry *te); -typedef void (*ReadExtraTocPtr) (ArchiveHandle *AH, TocEntry *te); -typedef void (*PrintExtraTocPtr) (ArchiveHandle *AH, TocEntry *te); -typedef void (*PrintTocDataPtr) (ArchiveHandle *AH, TocEntry *te); +typedef int (*WriteBytePtrType) (ArchiveHandle *AH, const int i); +typedef int (*ReadBytePtrType) (ArchiveHandle *AH); +typedef void (*WriteBufPtrType) (ArchiveHandle *AH, const void *c, size_t = len); +typedef void (*ReadBufPtrType) (ArchiveHandle *AH, void *buf, size_t len); +typedef void (*SaveArchivePtrType) (ArchiveHandle *AH); +typedef void (*WriteExtraTocPtrType) (ArchiveHandle *AH, TocEntry *te); +typedef void (*ReadExtraTocPtrType) (ArchiveHandle *AH, TocEntry *te); +typedef void (*PrintExtraTocPtrType) (ArchiveHandle *AH, TocEntry *te); +typedef void (*PrintTocDataPtrType) (ArchiveHandle *AH, TocEntry *te); =20 -typedef void (*ClonePtr) (ArchiveHandle *AH); -typedef void (*DeClonePtr) (ArchiveHandle *AH); +typedef void (*ClonePtrType) (ArchiveHandle *AH); +typedef void (*DeClonePtrType) (ArchiveHandle *AH); =20 -typedef int (*WorkerJobDumpPtr) (ArchiveHandle *AH, TocEntry *te); -typedef int (*WorkerJobRestorePtr) (ArchiveHandle *AH, TocEntry *te); +typedef int (*WorkerJobDumpPtrType) (ArchiveHandle *AH, TocEntry *te); +typedef int (*WorkerJobRestorePtrType) (ArchiveHandle *AH, TocEntry *te); =20 -typedef size_t (*CustomOutPtr) (ArchiveHandle *AH, const void *buf, size_t= len); +typedef size_t (*CustomOutPtrType) (ArchiveHandle *AH, const void *buf, si= ze_t len); =20 typedef enum { @@ -242,39 +242,39 @@ struct _archiveHandle size_t lookaheadLen; /* Length of data in lookahead */ pgoff_t lookaheadPos; /* Current read position in lookahead buffer */ =20 - ArchiveEntryPtr ArchiveEntryPtr; /* Called for each metadata object */ - StartDataPtr StartDataPtr; /* Called when table data is about to be + ArchiveEntryPtrType ArchiveEntryPtr; /* Called for each metadata object */ + StartDataPtrType StartDataPtr; /* Called when table data is about to be * dumped */ - WriteDataPtr WriteDataPtr; /* Called to send some table data to the + WriteDataPtrType WriteDataPtr; /* Called to send some table data to the * archive */ - EndDataPtr EndDataPtr; /* Called when table data dump is finished */ - WriteBytePtr WriteBytePtr; /* Write a byte to output */ - ReadBytePtr ReadBytePtr; /* Read a byte from an archive */ - WriteBufPtr WriteBufPtr; /* Write a buffer of output to the archive */ - ReadBufPtr ReadBufPtr; /* Read a buffer of input from the archive */ - ClosePtr ClosePtr; /* Close the archive */ - ReopenPtr ReopenPtr; /* Reopen the archive */ - WriteExtraTocPtr WriteExtraTocPtr; /* Write extra TOC entry data + EndDataPtrType EndDataPtr; /* Called when table data dump is finished */ + WriteBytePtrType WriteBytePtr; /* Write a byte to output */ + ReadBytePtrType ReadBytePtr; /* Read a byte from an archive */ + WriteBufPtrType WriteBufPtr; /* Write a buffer of output to the archive */ + ReadBufPtrType ReadBufPtr; /* Read a buffer of input from the archive */ + ClosePtrType ClosePtr; /* Close the archive */ + ReopenPtrType ReopenPtr; /* Reopen the archive */ + WriteExtraTocPtrType WriteExtraTocPtr; /* Write extra TOC entry data * associated with the current archive * format */ - ReadExtraTocPtr ReadExtraTocPtr; /* Read extr info associated with + ReadExtraTocPtrType ReadExtraTocPtr; /* Read extr info associated with * archie format */ - PrintExtraTocPtr PrintExtraTocPtr; /* Extra TOC info for format */ - PrintTocDataPtr PrintTocDataPtr; + PrintExtraTocPtrType PrintExtraTocPtr; /* Extra TOC info for format */ + PrintTocDataPtrType PrintTocDataPtr; =20 - StartBlobsPtr StartBlobsPtr; - EndBlobsPtr EndBlobsPtr; - StartBlobPtr StartBlobPtr; - EndBlobPtr EndBlobPtr; + StartBlobsPtrType StartBlobsPtr; + EndBlobsPtrType EndBlobsPtr; + StartBlobPtrType StartBlobPtr; + EndBlobPtrType EndBlobPtr; =20 - SetupWorkerPtr SetupWorkerPtr; - WorkerJobDumpPtr WorkerJobDumpPtr; - WorkerJobRestorePtr WorkerJobRestorePtr; + SetupWorkerPtrType SetupWorkerPtr; + WorkerJobDumpPtrType WorkerJobDumpPtr; + WorkerJobRestorePtrType WorkerJobRestorePtr; =20 - ClonePtr ClonePtr; /* Clone format-specific fields */ - DeClonePtr DeClonePtr; /* Clean up cloned fields */ + ClonePtrType ClonePtr; /* Clone format-specific fields */ + DeClonePtrType DeClonePtr; /* Clean up cloned fields */ =20 - CustomOutPtr CustomOutPtr; /* Alternative script output routine */ + CustomOutPtrType CustomOutPtr; /* Alternative script output routine */ =20 /* Stuff for direct DB connection */ char *archdbname; /* DB name *read* from archive */ --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0006-Reorder-some-things.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="v2-0006-Reorder-some-things.patch" =46rom 997b09fca65a139af8e73d7e6356739383bd8df1 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 06/23] Reorder some things Forward declarations of static variables are not possible in C++, so move the full definition before its use. --- src/port/pg_crc32c_sb8.c | 136 +++++++++++++++++++++++--------------------= ---- 1 file changed, 67 insertions(+), 69 deletions(-) diff --git a/src/port/pg_crc32c_sb8.c b/src/port/pg_crc32c_sb8.c index eff7043202..92458a3062 100644 --- a/src/port/pg_crc32c_sb8.c +++ b/src/port/pg_crc32c_sb8.c @@ -22,8 +22,6 @@ =20 #include "port/pg_crc32c.h" =20 -static const uint32 pg_crc32c_table[8][256]; - /* Accumulate one input byte */ #ifdef WORDS_BIGENDIAN #define CRC8(x) pg_crc32c_table[0][((crc >> 24) ^ (x)) & 0xFF] ^ (crc << 8) @@ -31,73 +29,6 @@ static const uint32 pg_crc32c_table[8][256]; #define CRC8(x) pg_crc32c_table[0][(crc ^ (x)) & 0xFF] ^ (crc >> 8) #endif =20 -pg_crc32c -pg_comp_crc32c_sb8(pg_crc32c crc, const void *data, size_t len) -{ - const unsigned char *p =3D data; - const uint32 *p4; - - /* - * Handle 0-3 initial bytes one at a time, so that the loop below starts - * with a pointer aligned to four bytes. - */ - while (len > 0 && ((uintptr_t) p & 3)) - { - crc =3D CRC8(*p++); - len--; - } - - /* - * Process eight bytes of data at a time. - */ - p4 =3D (const uint32 *) p; - while (len >=3D 8) - { - uint32 a =3D *p4++ ^ crc; - uint32 b =3D *p4++; - -#ifdef WORDS_BIGENDIAN - const uint8 c0 =3D b; - const uint8 c1 =3D b >> 8; - const uint8 c2 =3D b >> 16; - const uint8 c3 =3D b >> 24; - const uint8 c4 =3D a; - const uint8 c5 =3D a >> 8; - const uint8 c6 =3D a >> 16; - const uint8 c7 =3D a >> 24; -#else - const uint8 c0 =3D b >> 24; - const uint8 c1 =3D b >> 16; - const uint8 c2 =3D b >> 8; - const uint8 c3 =3D b; - const uint8 c4 =3D a >> 24; - const uint8 c5 =3D a >> 16; - const uint8 c6 =3D a >> 8; - const uint8 c7 =3D a; -#endif - - crc =3D - pg_crc32c_table[0][c0] ^ pg_crc32c_table[1][c1] ^ - pg_crc32c_table[2][c2] ^ pg_crc32c_table[3][c3] ^ - pg_crc32c_table[4][c4] ^ pg_crc32c_table[5][c5] ^ - pg_crc32c_table[6][c6] ^ pg_crc32c_table[7][c7]; - - len -=3D 8; - } - - /* - * Handle any remaining bytes one at a time. - */ - p =3D (const unsigned char *) p4; - while (len > 0) - { - crc =3D CRC8(*p++); - len--; - } - - return crc; -} - /* * Lookup tables for the slicing-by-8 algorithm, for the so-called Castagn= oli * polynomial (the same that is used e.g. in iSCSI), 0x1EDC6F41. Using @@ -1167,3 +1098,70 @@ static const uint32 pg_crc32c_table[8][256] =3D { } #endif /* WORDS_BIGENDIAN */ }; + +pg_crc32c +pg_comp_crc32c_sb8(pg_crc32c crc, const void *data, size_t len) +{ + const unsigned char *p =3D data; + const uint32 *p4; + + /* + * Handle 0-3 initial bytes one at a time, so that the loop below starts + * with a pointer aligned to four bytes. + */ + while (len > 0 && ((uintptr_t) p & 3)) + { + crc =3D CRC8(*p++); + len--; + } + + /* + * Process eight bytes of data at a time. + */ + p4 =3D (const uint32 *) p; + while (len >=3D 8) + { + uint32 a =3D *p4++ ^ crc; + uint32 b =3D *p4++; + +#ifdef WORDS_BIGENDIAN + const uint8 c0 =3D b; + const uint8 c1 =3D b >> 8; + const uint8 c2 =3D b >> 16; + const uint8 c3 =3D b >> 24; + const uint8 c4 =3D a; + const uint8 c5 =3D a >> 8; + const uint8 c6 =3D a >> 16; + const uint8 c7 =3D a >> 24; +#else + const uint8 c0 =3D b >> 24; + const uint8 c1 =3D b >> 16; + const uint8 c2 =3D b >> 8; + const uint8 c3 =3D b; + const uint8 c4 =3D a >> 24; + const uint8 c5 =3D a >> 16; + const uint8 c6 =3D a >> 8; + const uint8 c7 =3D a; +#endif + + crc =3D + pg_crc32c_table[0][c0] ^ pg_crc32c_table[1][c1] ^ + pg_crc32c_table[2][c2] ^ pg_crc32c_table[3][c3] ^ + pg_crc32c_table[4][c4] ^ pg_crc32c_table[5][c5] ^ + pg_crc32c_table[6][c6] ^ pg_crc32c_table[7][c7]; + + len -=3D 8; + } + + /* + * Handle any remaining bytes one at a time. + */ + p =3D (const unsigned char *) p4; + while (len > 0) + { + crc =3D CRC8(*p++); + len--; + } + + return crc; +} --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0007-Eliminate-C-keywords.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="v2-0007-Eliminate-C-keywords.patch" =46rom e3393f8f5718b31c4ffe0346edabd8b08a2c7a3f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 07/23] Eliminate C++ keywords Remove use of these keywords: class constexpr delete friend namespace new operator private public template this typeid typename --- contrib/hstore/hstore.h | 2 +- contrib/ltree/ltree_op.c | 4 +- contrib/postgres_fdw/postgres_fdw.c | 12 +- src/backend/access/brin/brin_inclusion.c | 6 +- src/backend/access/gist/gistproc.c | 6 +- src/backend/access/transam/xlog.c | 22 +- src/backend/catalog/namespace.c | 40 +- src/backend/catalog/objectaddress.c | 22 +- src/backend/catalog/partition.c | 6 +- src/backend/catalog/pg_db_role_setting.c | 8 +- src/backend/commands/alter.c | 6 +- src/backend/commands/collationcmds.c | 6 +- src/backend/commands/explain.c | 14 +- src/backend/commands/functioncmds.c | 34 +- src/backend/commands/tablecmds.c | 10 +- src/backend/commands/typecmds.c | 70 ++-- src/backend/executor/execReplication.c | 8 +- src/backend/nodes/copyfuncs.c | 14 +- src/backend/optimizer/geqo/geqo_erx.c | 20 +- src/backend/optimizer/geqo/geqo_eval.c | 4 +- src/backend/optimizer/geqo/geqo_main.c | 6 +- src/backend/optimizer/geqo/geqo_random.c | 12 +- src/backend/optimizer/util/predtest.c | 20 +- src/backend/parser/gram.y | 12 +- src/backend/parser/parse_clause.c | 44 +- src/backend/parser/parse_node.c | 48 +-- src/backend/parser/scan.l | 20 +- src/backend/tcop/fastpath.c | 10 +- src/backend/tsearch/spell.c | 10 +- src/backend/utils/adt/acl.c | 18 +- src/backend/utils/adt/array_selfuncs.c | 64 +-- src/backend/utils/adt/format_type.c | 6 +- src/backend/utils/adt/misc.c | 10 +- src/backend/utils/adt/network_gist.c | 14 +- src/backend/utils/adt/network_selfuncs.c | 56 +-- src/backend/utils/adt/numeric.c | 22 +- src/backend/utils/adt/rangetypes_gist.c | 24 +- src/backend/utils/adt/rangetypes_selfuncs.c | 52 +-- src/backend/utils/adt/regproc.c | 16 +- src/backend/utils/adt/ri_triggers.c | 22 +- src/backend/utils/adt/ruleutils.c | 24 +- src/backend/utils/adt/selfuncs.c | 120 +++--- src/backend/utils/adt/tsquery.c | 18 +- src/backend/utils/adt/tsquery_op.c | 6 +- src/backend/utils/adt/varbit.c | 6 +- src/backend/utils/adt/varchar.c | 6 +- src/backend/utils/adt/xml.c | 4 +- src/backend/utils/cache/ts_cache.c | 14 +- src/backend/utils/fmgr/dfmgr.c | 38 +- src/backend/utils/init/miscinit.c | 6 +- src/bin/pg_dump/common.c | 4 +- src/bin/pg_dump/parallel.c | 16 +- src/bin/pg_dump/pg_backup.h | 2 +- src/bin/pg_dump/pg_backup_archiver.c | 136 +++---- src/bin/pg_dump/pg_backup_archiver.h | 8 +- src/bin/pg_dump/pg_backup_custom.c | 4 +- src/bin/pg_dump/pg_backup_db.c | 16 +- src/bin/pg_dump/pg_backup_directory.c | 4 +- src/bin/pg_dump/pg_backup_null.c | 2 +- src/bin/pg_dump/pg_backup_tar.c | 16 +- src/bin/pg_dump/pg_dump.c | 454 ++++++++++----------- src/bin/pg_dump/pg_dump.h | 4 +- src/bin/pg_dump/pg_dump_sort.c | 12 +- src/bin/pg_rewind/parsexlog.c | 44 +- src/bin/pg_waldump/pg_waldump.c | 100 ++--- src/bin/pgbench/exprparse.y | 6 +- src/bin/psql/tab-complete.c | 40 +- src/bin/scripts/createdb.c | 8 +- src/interfaces/ecpg/compatlib/informix.c | 10 +- src/interfaces/ecpg/ecpglib/connect.c | 36 +- src/interfaces/ecpg/ecpglib/descriptor.c | 30 +- src/interfaces/ecpg/ecpglib/memory.c | 20 +- src/interfaces/ecpg/ecpglib/prepare.c | 88 ++-- src/interfaces/ecpg/pgtypeslib/common.c | 12 +- src/interfaces/ecpg/preproc/descriptor.c | 30 +- src/interfaces/ecpg/preproc/ecpg.addons | 32 +- src/interfaces/ecpg/preproc/ecpg.c | 44 +- src/interfaces/ecpg/preproc/ecpg.header | 28 +- src/interfaces/ecpg/preproc/ecpg.trailer | 98 ++--- src/interfaces/ecpg/preproc/pgc.l | 44 +- src/interfaces/ecpg/preproc/type.c | 12 +- src/interfaces/ecpg/preproc/type.h | 4 +- src/interfaces/ecpg/preproc/variable.c | 20 +- src/pl/plpgsql/src/pl_comp.c | 86 ++-- src/pl/plpgsql/src/pl_exec.c | 68 ++-- src/pl/plpgsql/src/pl_gram.y | 600 ++++++++++++++----------= ---- src/pl/plpgsql/src/plpgsql.h | 4 +- src/port/path.c | 16 +- src/test/isolation/isolationtester.c | 6 +- src/test/regress/pg_regress.c | 6 +- 90 files changed, 1606 insertions(+), 1606 deletions(-) diff --git a/contrib/hstore/hstore.h b/contrib/hstore/hstore.h index 6bab08b7de..fbedc971c0 100644 --- a/contrib/hstore/hstore.h +++ b/contrib/hstore/hstore.h @@ -188,7 +188,7 @@ extern Pairs *hstoreArrayToPairs(ArrayType *a, int *npa= irs); * for now, we default to on for the benefit of people restoring old dumps */ #ifndef HSTORE_POLLUTE_NAMESPACE -#define HSTORE_POLLUTE_NAMESPACE 1 +#define HSTORE_POLLUTE_NAMESPACE 0 #endif =20 #if HSTORE_POLLUTE_NAMESPACE diff --git a/contrib/ltree/ltree_op.c b/contrib/ltree/ltree_op.c index aa1e9918be..b51cde715e 100644 --- a/contrib/ltree/ltree_op.c +++ b/contrib/ltree/ltree_op.c @@ -545,7 +545,7 @@ Datum ltreeparentsel(PG_FUNCTION_ARGS) { PlannerInfo *root =3D (PlannerInfo *) PG_GETARG_POINTER(0); - Oid operator =3D PG_GETARG_OID(1); + Oid opid =3D PG_GETARG_OID(1); List *args =3D (List *) PG_GETARG_POINTER(2); int varRelid =3D PG_GETARG_INT32(3); VariableStatData vardata; @@ -582,7 +582,7 @@ ltreeparentsel(PG_FUNCTION_ARGS) double nullfrac; int hist_size; =20 - fmgr_info(get_opcode(operator), &contproc); + fmgr_info(get_opcode(opid), &contproc); =20 /* * Is the constant "<@" to any of the column's most common values? diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/pos= tgres_fdw.c index 5d270b948a..3b58944d69 100644 --- a/contrib/postgres_fdw/postgres_fdw.c +++ b/contrib/postgres_fdw/postgres_fdw.c @@ -486,7 +486,7 @@ postgresGetForeignRelSize(PlannerInfo *root, PgFdwRelationInfo *fpinfo; ListCell *lc; RangeTblEntry *rte =3D planner_rt_fetch(baserel->relid, root); - const char *namespace; + const char *nspname; const char *relname; const char *refname; =20 @@ -659,11 +659,11 @@ postgresGetForeignRelSize(PlannerInfo *root, * not, so always schema-qualify the foreign table name. */ fpinfo->relation_name =3D makeStringInfo(); - namespace =3D get_namespace_name(get_rel_namespace(foreigntableid)); + nspname =3D get_namespace_name(get_rel_namespace(foreigntableid)); relname =3D get_rel_name(foreigntableid); refname =3D rte->eref->aliasname; appendStringInfo(fpinfo->relation_name, "%s.%s", - quote_identifier(namespace), + quote_identifier(nspname), quote_identifier(relname)); if (*refname && strcmp(refname, relname) !=3D 0) appendStringInfo(fpinfo->relation_name, " %s", @@ -3938,7 +3938,7 @@ postgresImportForeignSchema(ImportForeignSchemaStmt *= stmt, Oid serverOid) do { char *attname; - char *typename; + char *typname; char *attnotnull; char *attdefault; char *collname; @@ -3949,7 +3949,7 @@ postgresImportForeignSchema(ImportForeignSchemaStmt *= stmt, Oid serverOid) continue; =20 attname =3D PQgetvalue(res, i, 1); - typename =3D PQgetvalue(res, i, 2); + typname =3D PQgetvalue(res, i, 2); attnotnull =3D PQgetvalue(res, i, 3); attdefault =3D PQgetisnull(res, i, 4) ? (char *) NULL : PQgetvalue(res, i, 4); @@ -3966,7 +3966,7 @@ postgresImportForeignSchema(ImportForeignSchemaStmt *= stmt, Oid serverOid) /* Print column name and type */ appendStringInfo(&buf, " %s %s", quote_identifier(attname), - typename); + typname); =20 /* * Add column_name option so that renaming the foreign table's diff --git a/src/backend/access/brin/brin_inclusion.c b/src/backend/access/= brin/brin_inclusion.c index bc16dd7981..b1a277eca3 100644 --- a/src/backend/access/brin/brin_inclusion.c +++ b/src/backend/access/brin/brin_inclusion.c @@ -139,7 +139,7 @@ brin_inclusion_add_value(PG_FUNCTION_ARGS) Oid colloid =3D PG_GET_COLLATION(); FmgrInfo *finfo; Datum result; - bool new =3D false; + bool isnew =3D false; AttrNumber attno; Form_pg_attribute attr; =20 @@ -170,7 +170,7 @@ brin_inclusion_add_value(PG_FUNCTION_ARGS) column->bv_values[INCLUSION_UNMERGEABLE] =3D BoolGetDatum(false); column->bv_values[INCLUSION_CONTAINS_EMPTY] =3D BoolGetDatum(false); column->bv_allnulls =3D false; - new =3D true; + isnew =3D true; } =20 /* @@ -197,7 +197,7 @@ brin_inclusion_add_value(PG_FUNCTION_ARGS) PG_RETURN_BOOL(false); } =20 - if (new) + if (isnew) PG_RETURN_BOOL(true); =20 /* Check if the new value is already contained. */ diff --git a/src/backend/access/gist/gistproc.c b/src/backend/access/gist/g= istproc.c index ffb1d772ad..4394dd88f7 100644 --- a/src/backend/access/gist/gistproc.c +++ b/src/backend/access/gist/gistproc.c @@ -92,12 +92,12 @@ size_box(const BOX *box) * the original BOX's area. The result can be +Infinity, but not NaN. */ static double -box_penalty(const BOX *original, const BOX *new) +box_penalty(const BOX *originalbox, const BOX *newbox) { BOX unionbox; =20 - rt_box_union(&unionbox, original, new); - return size_box(&unionbox) - size_box(original); + rt_box_union(&unionbox, originalbox, newbox); + return size_box(&unionbox) - size_box(originalbox); } =20 /* diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam= /xlog.c index 897358342d..038b8472ae 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -4128,12 +4128,12 @@ ReadRecord(XLogReaderState *xlogreader, XLogRecPtr = RecPtr, int emode, bool fetching_ckpt) { XLogRecord *record; - XLogPageReadPrivate *private =3D (XLogPageReadPrivate *) xlogreader->priv= ate_data; + XLogPageReadPrivate *private_data =3D (XLogPageReadPrivate *) xlogreader-= >private_data; =20 /* Pass through parameters to XLogPageRead */ - private->fetching_ckpt =3D fetching_ckpt; - private->emode =3D emode; - private->randAccess =3D (RecPtr !=3D InvalidXLogRecPtr); + private_data->fetching_ckpt =3D fetching_ckpt; + private_data->emode =3D emode; + private_data->randAccess =3D (RecPtr !=3D InvalidXLogRecPtr); =20 /* This is the first attempt to read this page. */ lastSourceFailed =3D false; @@ -6148,7 +6148,7 @@ StartupXLOG(void) bool backupFromStandby =3D false; DBState dbstate_at_startup; XLogReaderState *xlogreader; - XLogPageReadPrivate private; + XLogPageReadPrivate private_data; bool fast_promoted =3D false; struct stat st; =20 @@ -6285,8 +6285,8 @@ StartupXLOG(void) OwnLatch(&XLogCtl->recoveryWakeupLatch); =20 /* Set up XLOG reader facility */ - MemSet(&private, 0, sizeof(XLogPageReadPrivate)); - xlogreader =3D XLogReaderAllocate(&XLogPageRead, &private); + MemSet(&private_data, 0, sizeof(XLogPageReadPrivate)); + xlogreader =3D XLogReaderAllocate(&XLogPageRead, &private_data); if (!xlogreader) ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), @@ -11339,9 +11339,9 @@ static int XLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr, int re= qLen, XLogRecPtr targetRecPtr, char *readBuf, TimeLineID *readTLI) { - XLogPageReadPrivate *private =3D + XLogPageReadPrivate *private_data =3D (XLogPageReadPrivate *) xlogreader->private_data; - int emode =3D private->emode; + int emode =3D private_data->emode; uint32 targetPageOff; XLogSegNo targetSegNo PG_USED_FOR_ASSERTS_ONLY; =20 @@ -11382,8 +11382,8 @@ XLogPageRead(XLogReaderState *xlogreader, XLogRecPt= r targetPagePtr, int reqLen, receivedUpto < targetPagePtr + reqLen)) { if (!WaitForWALToBecomeAvailable(targetPagePtr + reqLen, - private->randAccess, - private->fetching_ckpt, + private_data->randAccess, + private_data->fetching_ckpt, targetRecPtr)) { if (readFile >=3D 0) diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespac= e.c index a38da3047f..302a55a0bf 100644 --- a/src/backend/catalog/namespace.c +++ b/src/backend/catalog/namespace.c @@ -2153,7 +2153,7 @@ TSParserIsVisible(Oid prsId) { HeapTuple tup; Form_pg_ts_parser form; - Oid namespace; + Oid prsnamespace; bool visible; =20 tup =3D SearchSysCache1(TSPARSEROID, ObjectIdGetDatum(prsId)); @@ -2168,9 +2168,9 @@ TSParserIsVisible(Oid prsId) * the system namespace are surely in the path and so we needn't even do * list_member_oid() for them. */ - namespace =3D form->prsnamespace; - if (namespace !=3D PG_CATALOG_NAMESPACE && - !list_member_oid(activeSearchPath, namespace)) + prsnamespace =3D form->prsnamespace; + if (prsnamespace !=3D PG_CATALOG_NAMESPACE && + !list_member_oid(activeSearchPath, prsnamespace)) visible =3D false; else { @@ -2190,7 +2190,7 @@ TSParserIsVisible(Oid prsId) if (namespaceId =3D=3D myTempNamespace) continue; /* do not look in temp namespace */ =20 - if (namespaceId =3D=3D namespace) + if (namespaceId =3D=3D prsnamespace) { /* Found it first in path */ visible =3D true; @@ -2279,7 +2279,7 @@ TSDictionaryIsVisible(Oid dictId) { HeapTuple tup; Form_pg_ts_dict form; - Oid namespace; + Oid dictnamespace; bool visible; =20 tup =3D SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId)); @@ -2295,9 +2295,9 @@ TSDictionaryIsVisible(Oid dictId) * the system namespace are surely in the path and so we needn't even do * list_member_oid() for them. */ - namespace =3D form->dictnamespace; - if (namespace !=3D PG_CATALOG_NAMESPACE && - !list_member_oid(activeSearchPath, namespace)) + dictnamespace =3D form->dictnamespace; + if (dictnamespace !=3D PG_CATALOG_NAMESPACE && + !list_member_oid(activeSearchPath, dictnamespace)) visible =3D false; else { @@ -2317,7 +2317,7 @@ TSDictionaryIsVisible(Oid dictId) if (namespaceId =3D=3D myTempNamespace) continue; /* do not look in temp namespace */ =20 - if (namespaceId =3D=3D namespace) + if (namespaceId =3D=3D dictnamespace) { /* Found it first in path */ visible =3D true; @@ -2406,7 +2406,7 @@ TSTemplateIsVisible(Oid tmplId) { HeapTuple tup; Form_pg_ts_template form; - Oid namespace; + Oid tmplnamespace; bool visible; =20 tup =3D SearchSysCache1(TSTEMPLATEOID, ObjectIdGetDatum(tmplId)); @@ -2421,9 +2421,9 @@ TSTemplateIsVisible(Oid tmplId) * the system namespace are surely in the path and so we needn't even do * list_member_oid() for them. */ - namespace =3D form->tmplnamespace; - if (namespace !=3D PG_CATALOG_NAMESPACE && - !list_member_oid(activeSearchPath, namespace)) + tmplnamespace =3D form->tmplnamespace; + if (tmplnamespace !=3D PG_CATALOG_NAMESPACE && + !list_member_oid(activeSearchPath, tmplnamespace)) visible =3D false; else { @@ -2443,7 +2443,7 @@ TSTemplateIsVisible(Oid tmplId) if (namespaceId =3D=3D myTempNamespace) continue; /* do not look in temp namespace */ =20 - if (namespaceId =3D=3D namespace) + if (namespaceId =3D=3D tmplnamespace) { /* Found it first in path */ visible =3D true; @@ -2532,7 +2532,7 @@ TSConfigIsVisible(Oid cfgid) { HeapTuple tup; Form_pg_ts_config form; - Oid namespace; + Oid cfgnamespace; bool visible; =20 tup =3D SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgid)); @@ -2548,9 +2548,9 @@ TSConfigIsVisible(Oid cfgid) * the system namespace are surely in the path and so we needn't even do * list_member_oid() for them. */ - namespace =3D form->cfgnamespace; - if (namespace !=3D PG_CATALOG_NAMESPACE && - !list_member_oid(activeSearchPath, namespace)) + cfgnamespace =3D form->cfgnamespace; + if (cfgnamespace !=3D PG_CATALOG_NAMESPACE && + !list_member_oid(activeSearchPath, cfgnamespace)) visible =3D false; else { @@ -2570,7 +2570,7 @@ TSConfigIsVisible(Oid cfgid) if (namespaceId =3D=3D myTempNamespace) continue; /* do not look in temp namespace */ =20 - if (namespaceId =3D=3D namespace) + if (namespaceId =3D=3D cfgnamespace) { /* Found it first in path */ visible =3D true; diff --git a/src/backend/catalog/objectaddress.c b/src/backend/catalog/obje= ctaddress.c index cc636e2e3e..fa3aa241cb 100644 --- a/src/backend/catalog/objectaddress.c +++ b/src/backend/catalog/objectaddress.c @@ -936,9 +936,9 @@ get_object_address(ObjectType objtype, List *objname, L= ist *objargs, break; case OBJECT_TRANSFORM: { - TypeName *typename =3D (TypeName *) linitial(objname); + TypeName *typname =3D (TypeName *) linitial(objname); char *langname =3D strVal(linitial(objargs)); - Oid type_id =3D LookupTypeNameOid(NULL, typename, missing_ok); + Oid type_id =3D LookupTypeNameOid(NULL, typname, missing_ok); Oid lang_id =3D get_language_oid(langname, missing_ok); =20 address.classId =3D TransformRelationId; @@ -1533,23 +1533,23 @@ static ObjectAddress get_object_address_type(ObjectType objtype, ListCell *typecell, bool missi= ng_ok) { ObjectAddress address; - TypeName *typename; + TypeName *typname; Type tup; =20 - typename =3D (TypeName *) lfirst(typecell); + typname =3D (TypeName *) lfirst(typecell); =20 address.classId =3D TypeRelationId; address.objectId =3D InvalidOid; address.objectSubId =3D 0; =20 - tup =3D LookupTypeName(NULL, typename, NULL, missing_ok); + tup =3D LookupTypeName(NULL, typname, NULL, missing_ok); if (!HeapTupleIsValid(tup)) { if (!missing_ok) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("type \"%s\" does not exist", - TypeNameToString(typename)))); + TypeNameToString(typname)))); return address; } address.objectId =3D typeTypeId(tup); @@ -1560,7 +1560,7 @@ get_object_address_type(ObjectType objtype, ListCell = *typecell, bool missing_ok) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\" is not a domain", - TypeNameToString(typename)))); + TypeNameToString(typname)))); } =20 ReleaseSysCache(tup); @@ -2285,11 +2285,11 @@ check_object_ownership(Oid roleid, ObjectType objty= pe, ObjectAddress address, break; case OBJECT_TRANSFORM: { - TypeName *typename =3D (TypeName *) linitial(objname); - Oid typeid =3D typenameTypeId(NULL, typename); + TypeName *typname =3D (TypeName *) linitial(objname); + Oid typid =3D typenameTypeId(NULL, typname); =20 - if (!pg_type_ownercheck(typeid, roleid)) - aclcheck_error_type(ACLCHECK_NOT_OWNER, typeid); + if (!pg_type_ownercheck(typid, roleid)) + aclcheck_error_type(ACLCHECK_NOT_OWNER, typid); } break; case OBJECT_TABLESPACE: diff --git a/src/backend/catalog/partition.c b/src/backend/catalog/partitio= n.c index 4bcef58763..2cf5d7828f 100644 --- a/src/backend/catalog/partition.c +++ b/src/backend/catalog/partition.c @@ -1259,10 +1259,10 @@ get_qual_for_list(PartitionKey key, PartitionBoundS= pec *spec) result =3D list_make2(nulltest1, opexpr); else if (nulltest2) { - Expr *or; + Expr *or_expr; =20 - or =3D makeBoolExpr(OR_EXPR, list_make2(nulltest2, opexpr), -1); - result =3D list_make1(or); + or_expr =3D makeBoolExpr(OR_EXPR, list_make2(nulltest2, opexpr), -1); + result =3D list_make1(or_expr); } else result =3D list_make1(opexpr); diff --git a/src/backend/catalog/pg_db_role_setting.c b/src/backend/catalog= /pg_db_role_setting.c index 323471bc83..56b9de29df 100644 --- a/src/backend/catalog/pg_db_role_setting.c +++ b/src/backend/catalog/pg_db_role_setting.c @@ -62,7 +62,7 @@ AlterSetting(Oid databaseid, Oid roleid, VariableSetStmt = *setstmt) { if (HeapTupleIsValid(tuple)) { - ArrayType *new =3D NULL; + ArrayType *newarray =3D NULL; Datum datum; bool isnull; =20 @@ -70,9 +70,9 @@ AlterSetting(Oid databaseid, Oid roleid, VariableSetStmt = *setstmt) RelationGetDescr(rel), &isnull); =20 if (!isnull) - new =3D GUCArrayReset(DatumGetArrayTypeP(datum)); + newarray =3D GUCArrayReset(DatumGetArrayTypeP(datum)); =20 - if (new) + if (newarray) { Datum repl_val[Natts_pg_db_role_setting]; bool repl_null[Natts_pg_db_role_setting]; @@ -82,7 +82,7 @@ AlterSetting(Oid databaseid, Oid roleid, VariableSetStmt = *setstmt) memset(repl_repl, false, sizeof(repl_repl)); =20 repl_val[Anum_pg_db_role_setting_setconfig - 1] =3D - PointerGetDatum(new); + PointerGetDatum(newarray); repl_repl[Anum_pg_db_role_setting_setconfig - 1] =3D true; repl_null[Anum_pg_db_role_setting_setconfig - 1] =3D false; =20 diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c index d6195e49f5..aab5021774 100644 --- a/src/backend/commands/alter.c +++ b/src/backend/commands/alter.c @@ -609,7 +609,7 @@ AlterObjectNamespace_internal(Relation rel, Oid objid, = Oid nspOid) AclObjectKind acl_kind =3D get_object_aclkind(classId); Oid oldNspOid; Datum name, - namespace; + nsp; bool isnull; HeapTuple tup, newtup; @@ -624,10 +624,10 @@ AlterObjectNamespace_internal(Relation rel, Oid objid= , Oid nspOid) =20 name =3D heap_getattr(tup, Anum_name, RelationGetDescr(rel), &isnull); Assert(!isnull); - namespace =3D heap_getattr(tup, Anum_namespace, RelationGetDescr(rel), + nsp =3D heap_getattr(tup, Anum_namespace, RelationGetDescr(rel), &isnull); Assert(!isnull); - oldNspOid =3D DatumGetObjectId(namespace); + oldNspOid =3D DatumGetObjectId(nsp); =20 /* * If the object is already in the correct namespace, we don't need to do diff --git a/src/backend/commands/collationcmds.c b/src/backend/commands/co= llationcmds.c index 919cfc6a06..48c2704cd1 100644 --- a/src/backend/commands/collationcmds.c +++ b/src/backend/commands/collationcmds.c @@ -191,10 +191,10 @@ IsThereCollationInNamespace(const char *collname, Oid= nspOid) */ pg_attribute_unused() static bool -normalize_locale_name(char *new, const char *old) +normalize_locale_name(char *newname, const char *oldname) { - char *n =3D new; - const char *o =3D old; + char *n =3D newname; + const char *o =3D oldname; bool changed =3D false; =20 while (*o) diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index c9e0a3e42d..dfdfb75a23 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -2534,7 +2534,7 @@ static void ExplainTargetRel(Plan *plan, Index rti, ExplainState *es) { char *objectname =3D NULL; - char *namespace =3D NULL; + char *namespacename =3D NULL; const char *objecttag =3D NULL; RangeTblEntry *rte; char *refname; @@ -2559,7 +2559,7 @@ ExplainTargetRel(Plan *plan, Index rti, ExplainState = *es) Assert(rte->rtekind =3D=3D RTE_RELATION); objectname =3D get_rel_name(rte->relid); if (es->verbose) - namespace =3D get_namespace_name(get_rel_namespace(rte->relid)); + namespacename =3D get_namespace_name(get_rel_namespace(rte->relid)); objecttag =3D "Relation Name"; break; case T_FunctionScan: @@ -2586,7 +2586,7 @@ ExplainTargetRel(Plan *plan, Index rti, ExplainState = *es) =20 objectname =3D get_func_name(funcid); if (es->verbose) - namespace =3D + namespacename =3D get_namespace_name(get_func_namespace(funcid)); } } @@ -2617,8 +2617,8 @@ ExplainTargetRel(Plan *plan, Index rti, ExplainState = *es) if (es->format =3D=3D EXPLAIN_FORMAT_TEXT) { appendStringInfoString(es->str, " on"); - if (namespace !=3D NULL) - appendStringInfo(es->str, " %s.%s", quote_identifier(namespace), + if (namespacename !=3D NULL) + appendStringInfo(es->str, " %s.%s", quote_identifier(namespacename), quote_identifier(objectname)); else if (objectname !=3D NULL) appendStringInfo(es->str, " %s", quote_identifier(objectname)); @@ -2629,8 +2629,8 @@ ExplainTargetRel(Plan *plan, Index rti, ExplainState = *es) { if (objecttag !=3D NULL && objectname !=3D NULL) ExplainPropertyText(objecttag, objectname, es); - if (namespace !=3D NULL) - ExplainPropertyText("Schema", namespace, es); + if (namespacename !=3D NULL) + ExplainPropertyText("Schema", namespacename, es); ExplainPropertyText("Alias", refname, es); } } diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/fun= ctioncmds.c index 8b1285a542..1494e2a26f 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -972,13 +972,13 @@ CreateFunction(ParseState *pstate, CreateFunctionStmt= *stmt) =20 foreach(lc, castNode(List, transformDefElem)) { - Oid typeid =3D typenameTypeId(NULL, lfirst(lc)); - Oid elt =3D get_base_element_type(typeid); + Oid typid =3D typenameTypeId(NULL, lfirst(lc)); + Oid elt =3D get_base_element_type(typid); =20 - typeid =3D elt ? elt : typeid; + typid =3D elt ? elt : typid; =20 - get_transform_oid(typeid, languageOid, false); - trftypes_list =3D lappend_oid(trftypes_list, typeid); + get_transform_oid(typid, languageOid, false); + trftypes_list =3D lappend_oid(trftypes_list, typid); } } =20 @@ -1779,7 +1779,7 @@ check_transform_function(Form_pg_proc procstruct) ObjectAddress CreateTransform(CreateTransformStmt *stmt) { - Oid typeid; + Oid typid; char typtype; Oid langid; Oid fromsqlfuncid; @@ -1800,8 +1800,8 @@ CreateTransform(CreateTransformStmt *stmt) /* * Get the type */ - typeid =3D typenameTypeId(NULL, stmt->type_name); - typtype =3D get_typtype(typeid); + typid =3D typenameTypeId(NULL, stmt->type_name); + typtype =3D get_typtype(typid); =20 if (typtype =3D=3D TYPTYPE_PSEUDO) ereport(ERROR, @@ -1815,12 +1815,12 @@ CreateTransform(CreateTransformStmt *stmt) errmsg("data type %s is a domain", TypeNameToString(stmt->type_name)))); =20 - if (!pg_type_ownercheck(typeid, GetUserId())) - aclcheck_error_type(ACLCHECK_NOT_OWNER, typeid); + if (!pg_type_ownercheck(typid, GetUserId())) + aclcheck_error_type(ACLCHECK_NOT_OWNER, typid); =20 - aclresult =3D pg_type_aclcheck(typeid, GetUserId(), ACL_USAGE); + aclresult =3D pg_type_aclcheck(typid, GetUserId(), ACL_USAGE); if (aclresult !=3D ACLCHECK_OK) - aclcheck_error_type(aclresult, typeid); + aclcheck_error_type(aclresult, typid); =20 /* * Get the language @@ -1875,7 +1875,7 @@ CreateTransform(CreateTransformStmt *stmt) if (!HeapTupleIsValid(tuple)) elog(ERROR, "cache lookup failed for function %u", tosqlfuncid); procstruct =3D (Form_pg_proc) GETSTRUCT(tuple); - if (procstruct->prorettype !=3D typeid) + if (procstruct->prorettype !=3D typid) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), errmsg("return data type of TO SQL function must be the transform da= ta type"))); @@ -1888,7 +1888,7 @@ CreateTransform(CreateTransformStmt *stmt) /* * Ready to go */ - values[Anum_pg_transform_trftype - 1] =3D ObjectIdGetDatum(typeid); + values[Anum_pg_transform_trftype - 1] =3D ObjectIdGetDatum(typid); values[Anum_pg_transform_trflang - 1] =3D ObjectIdGetDatum(langid); values[Anum_pg_transform_trffromsql - 1] =3D ObjectIdGetDatum(fromsqlfunc= id); values[Anum_pg_transform_trftosql - 1] =3D ObjectIdGetDatum(tosqlfuncid); @@ -1898,7 +1898,7 @@ CreateTransform(CreateTransformStmt *stmt) relation =3D heap_open(TransformRelationId, RowExclusiveLock); =20 tuple =3D SearchSysCache2(TRFTYPELANG, - ObjectIdGetDatum(typeid), + ObjectIdGetDatum(typid), ObjectIdGetDatum(langid)); if (HeapTupleIsValid(tuple)) { @@ -1906,7 +1906,7 @@ CreateTransform(CreateTransformStmt *stmt) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), errmsg("transform for type %s language \"%s\" already exists", - format_type_be(typeid), + format_type_be(typid), stmt->lang))); =20 MemSet(replaces, false, sizeof(replaces)); @@ -1943,7 +1943,7 @@ CreateTransform(CreateTransformStmt *stmt) =20 /* dependency on type */ referenced.classId =3D TypeRelationId; - referenced.objectId =3D typeid; + referenced.objectId =3D typid; referenced.objectSubId =3D 0; recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL); =20 diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablec= mds.c index 3cea220421..56906d603c 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -11391,7 +11391,7 @@ ATExecAddOf(Relation rel, const TypeName *ofTypenam= e, LOCKMODE lockmode) { Oid relid =3D RelationGetRelid(rel); Type typetuple; - Oid typeid; + Oid typid; Relation inheritsRelation, relationRelation; SysScanDesc scan; @@ -11407,7 +11407,7 @@ ATExecAddOf(Relation rel, const TypeName *ofTypenam= e, LOCKMODE lockmode) /* Validate the type. */ typetuple =3D typenameType(NULL, ofTypename, NULL); check_of_type(typetuple); - typeid =3D HeapTupleGetOid(typetuple); + typid =3D HeapTupleGetOid(typetuple); =20 /* Fail if the table has any inheritance parents. */ inheritsRelation =3D heap_open(InheritsRelationId, AccessShareLock); @@ -11429,7 +11429,7 @@ ATExecAddOf(Relation rel, const TypeName *ofTypenam= e, LOCKMODE lockmode) * require that the order also match. However, attnotnull need not match. * Also unlike inheritance, we do not require matching relhasoids. */ - typeTupleDesc =3D lookup_rowtype_tupdesc(typeid, -1); + typeTupleDesc =3D lookup_rowtype_tupdesc(typid, -1); tableTupleDesc =3D RelationGetDescr(rel); table_attno =3D 1; for (type_attno =3D 1; type_attno <=3D typeTupleDesc->natts; type_attno++) @@ -11496,7 +11496,7 @@ ATExecAddOf(Relation rel, const TypeName *ofTypenam= e, LOCKMODE lockmode) tableobj.objectId =3D relid; tableobj.objectSubId =3D 0; typeobj.classId =3D TypeRelationId; - typeobj.objectId =3D typeid; + typeobj.objectId =3D typid; typeobj.objectSubId =3D 0; recordDependencyOn(&tableobj, &typeobj, DEPENDENCY_NORMAL); =20 @@ -11505,7 +11505,7 @@ ATExecAddOf(Relation rel, const TypeName *ofTypenam= e, LOCKMODE lockmode) classtuple =3D SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relid)); if (!HeapTupleIsValid(classtuple)) elog(ERROR, "cache lookup failed for relation %u", relid); - ((Form_pg_class) GETSTRUCT(classtuple))->reloftype =3D typeid; + ((Form_pg_class) GETSTRUCT(classtuple))->reloftype =3D typid; CatalogTupleUpdate(relationRelation, &classtuple->t_self, classtuple); =20 InvokeObjectPostAlterHook(RelationRelationId, relid, 0); diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmd= s.c index d8bd8a50dd..a1a091fe2c 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -85,7 +85,7 @@ typedef struct /* Potentially set by pg_upgrade_support functions */ Oid binary_upgrade_next_array_pg_type_oid =3D InvalidOid; =20 -static void makeRangeConstructors(const char *name, Oid namespace, +static void makeRangeConstructors(const char *name, Oid namespaceOid, Oid rangeOid, Oid subtype); static Oid findTypeInputFunction(List *procname, Oid typeOid); static Oid findTypeOutputFunction(List *procname, Oid typeOid); @@ -1228,13 +1228,13 @@ ObjectAddress AlterEnum(AlterEnumStmt *stmt) { Oid enum_type_oid; - TypeName *typename; + TypeName *typeName; HeapTuple tup; ObjectAddress address; =20 /* Make a TypeName so we can use standard type lookup machinery */ - typename =3D makeTypeNameFromNameList(stmt->typeName); - enum_type_oid =3D typenameTypeId(NULL, typename); + typeName =3D makeTypeNameFromNameList(stmt->typeName); + enum_type_oid =3D typenameTypeId(NULL, typeName); =20 tup =3D SearchSysCache1(TYPEOID, ObjectIdGetDatum(enum_type_oid)); if (!HeapTupleIsValid(tup)) @@ -1563,7 +1563,7 @@ DefineRange(CreateRangeStmt *stmt) * to offer more convenience for the user. */ static void -makeRangeConstructors(const char *name, Oid namespace, +makeRangeConstructors(const char *name, Oid namespaceOid, Oid rangeOid, Oid subtype) { static const char *const prosrc[2] =3D {"range_constructor2", @@ -1591,7 +1591,7 @@ makeRangeConstructors(const char *name, Oid namespace, pronargs[i]); =20 myself =3D ProcedureCreate(name, /* name: same as range type */ - namespace, /* namespace */ + namespaceOid, /* namespace */ false, /* replace */ false, /* returns set */ rangeOid, /* return type */ @@ -2125,7 +2125,7 @@ DefineCompositeType(RangeVar *typevar, List *coldefli= st) ObjectAddress AlterDomainDefault(List *names, Node *defaultRaw) { - TypeName *typename; + TypeName *typeName; Oid domainoid; HeapTuple tup; ParseState *pstate; @@ -2140,8 +2140,8 @@ AlterDomainDefault(List *names, Node *defaultRaw) ObjectAddress address; =20 /* Make a TypeName so we can use standard type lookup machinery */ - typename =3D makeTypeNameFromNameList(names); - domainoid =3D typenameTypeId(NULL, typename); + typeName =3D makeTypeNameFromNameList(names); + domainoid =3D typenameTypeId(NULL, typeName); =20 /* Look up the domain in the type table */ rel =3D heap_open(TypeRelationId, RowExclusiveLock); @@ -2264,7 +2264,7 @@ AlterDomainDefault(List *names, Node *defaultRaw) ObjectAddress AlterDomainNotNull(List *names, bool notNull) { - TypeName *typename; + TypeName *typeName; Oid domainoid; Relation typrel; HeapTuple tup; @@ -2272,8 +2272,8 @@ AlterDomainNotNull(List *names, bool notNull) ObjectAddress address =3D InvalidObjectAddress; =20 /* Make a TypeName so we can use standard type lookup machinery */ - typename =3D makeTypeNameFromNameList(names); - domainoid =3D typenameTypeId(NULL, typename); + typeName =3D makeTypeNameFromNameList(names); + domainoid =3D typenameTypeId(NULL, typeName); =20 /* Look up the domain in the type table */ typrel =3D heap_open(TypeRelationId, RowExclusiveLock); @@ -2380,7 +2380,7 @@ ObjectAddress AlterDomainDropConstraint(List *names, const char *constrName, DropBehavior behavior, bool missing_ok) { - TypeName *typename; + TypeName *typeName; Oid domainoid; HeapTuple tup; Relation rel; @@ -2392,8 +2392,8 @@ AlterDomainDropConstraint(List *names, const char *co= nstrName, ObjectAddress address =3D InvalidObjectAddress; =20 /* Make a TypeName so we can use standard type lookup machinery */ - typename =3D makeTypeNameFromNameList(names); - domainoid =3D typenameTypeId(NULL, typename); + typeName =3D makeTypeNameFromNameList(names); + domainoid =3D typenameTypeId(NULL, typeName); =20 /* Look up the domain in the type table */ rel =3D heap_open(TypeRelationId, RowExclusiveLock); @@ -2451,11 +2451,11 @@ AlterDomainDropConstraint(List *names, const char *= constrName, ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("constraint \"%s\" of domain \"%s\" does not exist", - constrName, TypeNameToString(typename)))); + constrName, TypeNameToString(typeName)))); else ereport(NOTICE, (errmsg("constraint \"%s\" of domain \"%s\" does not exist, skipping", - constrName, TypeNameToString(typename)))); + constrName, TypeNameToString(typeName)))); } =20 return address; @@ -2470,7 +2470,7 @@ ObjectAddress AlterDomainAddConstraint(List *names, Node *newConstraint, ObjectAddress *constrAddr) { - TypeName *typename; + TypeName *typeName; Oid domainoid; Relation typrel; HeapTuple tup; @@ -2480,8 +2480,8 @@ AlterDomainAddConstraint(List *names, Node *newConstr= aint, ObjectAddress address; =20 /* Make a TypeName so we can use standard type lookup machinery */ - typename =3D makeTypeNameFromNameList(names); - domainoid =3D typenameTypeId(NULL, typename); + typeName =3D makeTypeNameFromNameList(names); + domainoid =3D typenameTypeId(NULL, typeName); =20 /* Look up the domain in the type table */ typrel =3D heap_open(TypeRelationId, RowExclusiveLock); @@ -2578,7 +2578,7 @@ AlterDomainAddConstraint(List *names, Node *newConstr= aint, ObjectAddress AlterDomainValidateConstraint(List *names, char *constrName) { - TypeName *typename; + TypeName *typeName; Oid domainoid; Relation typrel; Relation conrel; @@ -2596,8 +2596,8 @@ AlterDomainValidateConstraint(List *names, char *cons= trName) ObjectAddress address; =20 /* Make a TypeName so we can use standard type lookup machinery */ - typename =3D makeTypeNameFromNameList(names); - domainoid =3D typenameTypeId(NULL, typename); + typeName =3D makeTypeNameFromNameList(names); + domainoid =3D typenameTypeId(NULL, typeName); =20 /* Look up the domain in the type table */ typrel =3D heap_open(TypeRelationId, AccessShareLock); @@ -2634,13 +2634,13 @@ AlterDomainValidateConstraint(List *names, char *co= nstrName) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("constraint \"%s\" of domain \"%s\" does not exist", - constrName, TypeNameToString(typename)))); + constrName, TypeNameToString(typeName)))); =20 if (con->contype !=3D CONSTRAINT_CHECK) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("constraint \"%s\" of domain \"%s\" is not a check constraint", - constrName, TypeNameToString(typename)))); + constrName, TypeNameToString(typeName)))); =20 val =3D SysCacheGetAttr(CONSTROID, tuple, Anum_pg_constraint_conbin, @@ -3135,7 +3135,7 @@ RenameType(RenameStmt *stmt) { List *names =3D stmt->object; const char *newTypeName =3D stmt->newname; - TypeName *typename; + TypeName *typeName; Oid typeOid; Relation rel; HeapTuple tup; @@ -3143,8 +3143,8 @@ RenameType(RenameStmt *stmt) ObjectAddress address; =20 /* Make a TypeName so we can use standard type lookup machinery */ - typename =3D makeTypeNameFromNameList(names); - typeOid =3D typenameTypeId(NULL, typename); + typeName =3D makeTypeNameFromNameList(names); + typeOid =3D typenameTypeId(NULL, typeName); =20 /* Look up the type in the type table */ rel =3D heap_open(TypeRelationId, RowExclusiveLock); @@ -3211,7 +3211,7 @@ RenameType(RenameStmt *stmt) ObjectAddress AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype) { - TypeName *typename; + TypeName *typeName; Oid typeOid; Relation rel; HeapTuple tup; @@ -3223,15 +3223,15 @@ AlterTypeOwner(List *names, Oid newOwnerId, ObjectT= ype objecttype) rel =3D heap_open(TypeRelationId, RowExclusiveLock); =20 /* Make a TypeName so we can use standard type lookup machinery */ - typename =3D makeTypeNameFromNameList(names); + typeName =3D makeTypeNameFromNameList(names); =20 /* Use LookupTypeName here so that shell types can be processed */ - tup =3D LookupTypeName(NULL, typename, NULL, false); + tup =3D LookupTypeName(NULL, typeName, NULL, false); if (tup =3D=3D NULL) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("type \"%s\" does not exist", - TypeNameToString(typename)))); + TypeNameToString(typeName)))); typeOid =3D typeTypeId(tup); =20 /* Copy the syscache entry so we can scribble on it below */ @@ -3416,7 +3416,7 @@ ObjectAddress AlterTypeNamespace(List *names, const char *newschema, ObjectType objectty= pe, Oid *oldschema) { - TypeName *typename; + TypeName *typeName; Oid typeOid; Oid nspOid; Oid oldNspOid; @@ -3424,8 +3424,8 @@ AlterTypeNamespace(List *names, const char *newschema= , ObjectType objecttype, ObjectAddress myself; =20 /* Make a TypeName so we can use standard type lookup machinery */ - typename =3D makeTypeNameFromNameList(names); - typeOid =3D typenameTypeId(NULL, typename); + typeName =3D makeTypeNameFromNameList(names); + typeOid =3D typenameTypeId(NULL, typeName); =20 /* Don't allow ALTER DOMAIN on a type */ if (objecttype =3D=3D OBJECT_DOMAIN && get_typtype(typeOid) !=3D TYPTYPE_= DOMAIN) diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/= execReplication.c index f20d728ad5..5570a2f011 100644 --- a/src/backend/executor/execReplication.c +++ b/src/backend/executor/execReplication.c @@ -63,7 +63,7 @@ build_replindex_scan_key(ScanKey skey, Relation rel, Rela= tion idxrel, /* Build scankey for every attribute in the index. */ for (attoff =3D 0; attoff < RelationGetNumberOfAttributes(idxrel); attoff= ++) { - Oid operator; + Oid opid; Oid opfamily; RegProcedure regop; int pkattno =3D attoff + 1; @@ -76,15 +76,15 @@ build_replindex_scan_key(ScanKey skey, Relation rel, Re= lation idxrel, */ opfamily =3D get_opclass_family(opclass->values[attoff]); =20 - operator =3D get_opfamily_member(opfamily, optype, + opid =3D get_opfamily_member(opfamily, optype, optype, BTEqualStrategyNumber); =20 - if (!OidIsValid(operator)) + if (!OidIsValid(opid)) elog(ERROR, "could not find member %d(%u,%u) of opfamily %u", BTEqualStrategyNumber, optype, optype, opfamily); =20 - regop =3D get_opcode(operator); + regop =3D get_opcode(opid); =20 /* Initialize the scankey. */ ScanKeyInit(&skey[attoff], diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index 05d8538717..c3348991cd 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -4368,17 +4368,17 @@ _copyDropSubscriptionStmt(const DropSubscriptionStm= t *from) static List * _copyList(const List *from) { - List *new; + List *newnode; ListCell *curr_old; ListCell *prev_new; =20 Assert(list_length(from) >=3D 1); =20 - new =3D makeNode(List); - new->length =3D from->length; + newnode =3D makeNode(List); + newnode->length =3D from->length; =20 - COPY_NODE_CELL(new->head, from->head); - prev_new =3D new->head; + COPY_NODE_CELL(newnode->head, from->head); + prev_new =3D newnode->head; curr_old =3D lnext(from->head); =20 while (curr_old) @@ -4388,9 +4388,9 @@ _copyList(const List *from) curr_old =3D curr_old->next; } prev_new->next =3D NULL; - new->tail =3D prev_new; + newnode->tail =3D prev_new; =20 - return new; + return newnode; } =20 /* **************************************************************** diff --git a/src/backend/optimizer/geqo/geqo_erx.c b/src/backend/optimizer/= geqo/geqo_erx.c index 023abf70e2..9a765668b7 100644 --- a/src/backend/optimizer/geqo/geqo_erx.c +++ b/src/backend/optimizer/geqo/geqo_erx.c @@ -281,7 +281,7 @@ static Gene gimme_gene(PlannerInfo *root, Edge edge, Edge *edge_table) { int i; - Gene friend; + Gene friend_; int minimum_edges; int minimum_count =3D -1; int rand_decision; @@ -297,7 +297,7 @@ gimme_gene(PlannerInfo *root, Edge edge, Edge *edge_tab= le) =20 for (i =3D 0; i < edge.unused_edges; i++) { - friend =3D (Gene) edge.edge_list[i]; + friend_ =3D (Gene) edge.edge_list[i]; =20 /* * give priority to shared edges that are negative; so return 'em @@ -307,8 +307,8 @@ gimme_gene(PlannerInfo *root, Edge edge, Edge *edge_tab= le) * negative values are caught here so we need not worry about * converting to absolute values */ - if (friend < 0) - return (Gene) Abs(friend); + if (friend_ < 0) + return (Gene) Abs(friend_); =20 =20 /* @@ -327,14 +327,14 @@ gimme_gene(PlannerInfo *root, Edge edge, Edge *edge_t= able) */ =20 =20 - if (edge_table[(int) friend].unused_edges < minimum_edges) + if (edge_table[(int) friend_].unused_edges < minimum_edges) { - minimum_edges =3D edge_table[(int) friend].unused_edges; + minimum_edges =3D edge_table[(int) friend_].unused_edges; minimum_count =3D 1; } else if (minimum_count =3D=3D -1) elog(ERROR, "minimum_count not set"); - else if (edge_table[(int) friend].unused_edges =3D=3D minimum_edges) + else if (edge_table[(int) friend_].unused_edges =3D=3D minimum_edges) minimum_count++; =20 } /* for (i=3D0; ijoin_search_privat= e; + GeqoPrivateData *private_data =3D (GeqoPrivateData *) root->join_search_p= rivate; List *clumps; int rel_count; =20 @@ -187,7 +187,7 @@ gimme_tree(PlannerInfo *root, Gene *tour, int num_gene) =20 /* Get the next input relation */ cur_rel_index =3D (int) tour[rel_count]; - cur_rel =3D (RelOptInfo *) list_nth(private->initial_rels, + cur_rel =3D (RelOptInfo *) list_nth(private_data->initial_rels, cur_rel_index - 1); =20 /* Make it into a single-rel clump */ diff --git a/src/backend/optimizer/geqo/geqo_main.c b/src/backend/optimizer= /geqo/geqo_main.c index 52bd428187..c5d6b7c0c0 100644 --- a/src/backend/optimizer/geqo/geqo_main.c +++ b/src/backend/optimizer/geqo/geqo_main.c @@ -66,7 +66,7 @@ static int gimme_number_generations(int pool_size); RelOptInfo * geqo(PlannerInfo *root, int number_of_rels, List *initial_rels) { - GeqoPrivateData private; + GeqoPrivateData private_data; int generation; Chromosome *momma; Chromosome *daddy; @@ -94,8 +94,8 @@ geqo(PlannerInfo *root, int number_of_rels, List *initial= _rels) #endif =20 /* set up private information */ - root->join_search_private =3D (void *) &private; - private.initial_rels =3D initial_rels; + root->join_search_private =3D (void *) &private_data; + private_data.initial_rels =3D initial_rels; =20 /* initialize private number generator */ geqo_set_seed(root, Geqo_seed); diff --git a/src/backend/optimizer/geqo/geqo_random.c b/src/backend/optimiz= er/geqo/geqo_random.c index 6f3500649c..1e4ec0e545 100644 --- a/src/backend/optimizer/geqo/geqo_random.c +++ b/src/backend/optimizer/geqo/geqo_random.c @@ -19,22 +19,22 @@ void geqo_set_seed(PlannerInfo *root, double seed) { - GeqoPrivateData *private =3D (GeqoPrivateData *) root->join_search_privat= e; + GeqoPrivateData *private_data =3D (GeqoPrivateData *) root->join_search_p= rivate; =20 /* * XXX. This seeding algorithm could certainly be improved - but it is not * critical to do so. */ - memset(private->random_state, 0, sizeof(private->random_state)); - memcpy(private->random_state, + memset(private_data->random_state, 0, sizeof(private_data->random_state)); + memcpy(private_data->random_state, &seed, - Min(sizeof(private->random_state), sizeof(seed))); + Min(sizeof(private_data->random_state), sizeof(seed))); } =20 double geqo_rand(PlannerInfo *root) { - GeqoPrivateData *private =3D (GeqoPrivateData *) root->join_search_privat= e; + GeqoPrivateData *private_data =3D (GeqoPrivateData *) root->join_search_p= rivate; =20 - return pg_erand48(private->random_state); + return pg_erand48(private_data->random_state); } diff --git a/src/backend/optimizer/util/predtest.c b/src/backend/optimizer/= util/predtest.c index c4a04cfa95..da05429b9b 100644 --- a/src/backend/optimizer/util/predtest.c +++ b/src/backend/optimizer/util/predtest.c @@ -869,7 +869,7 @@ boolexpr_startup_fn(Node *clause, PredIterInfo info) typedef struct { OpExpr opexpr; - Const constexpr; + Const const_expr; int next_elem; int num_elems; Datum *elem_values; @@ -913,13 +913,13 @@ arrayconst_startup_fn(Node *clause, PredIterInfo info) state->opexpr.args =3D list_copy(saop->args); =20 /* Set up a dummy Const node to hold the per-element values */ - state->constexpr.xpr.type =3D T_Const; - state->constexpr.consttype =3D ARR_ELEMTYPE(arrayval); - state->constexpr.consttypmod =3D -1; - state->constexpr.constcollid =3D arrayconst->constcollid; - state->constexpr.constlen =3D elmlen; - state->constexpr.constbyval =3D elmbyval; - lsecond(state->opexpr.args) =3D &state->constexpr; + state->const_expr.xpr.type =3D T_Const; + state->const_expr.consttype =3D ARR_ELEMTYPE(arrayval); + state->const_expr.consttypmod =3D -1; + state->const_expr.constcollid =3D arrayconst->constcollid; + state->const_expr.constlen =3D elmlen; + state->const_expr.constbyval =3D elmbyval; + lsecond(state->opexpr.args) =3D &state->const_expr; =20 /* Initialize iteration state */ state->next_elem =3D 0; @@ -932,8 +932,8 @@ arrayconst_next_fn(PredIterInfo info) =20 if (state->next_elem >=3D state->num_elems) return NULL; - state->constexpr.constvalue =3D state->elem_values[state->next_elem]; - state->constexpr.constisnull =3D state->elem_nulls[state->next_elem]; + state->const_expr.constvalue =3D state->elem_values[state->next_elem]; + state->const_expr.constisnull =3D state->elem_nulls[state->next_elem]; state->next_elem++; return (Node *) &(state->opexpr); } diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index e833b2eba5..2e5ce3a5e8 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -144,9 +144,9 @@ static RawStmt *makeRawStmt(Node *stmt, int stmt_locati= on); static void updateRawStmtEnd(RawStmt *rs, int end_location); static Node *makeColumnRef(char *colname, List *indirection, int location, core_yyscan_t yyscanner); -static Node *makeTypeCast(Node *arg, TypeName *typename, int location); +static Node *makeTypeCast(Node *arg, TypeName *typname, int location); static Node *makeStringConst(char *str, int location); -static Node *makeStringConstCast(char *str, int location, TypeName *typena= me); +static Node *makeStringConstCast(char *str, int location, TypeName *typnam= e); static Node *makeIntConst(int val, int location); static Node *makeFloatConst(char *str, int location); static Node *makeBitStringConst(char *str, int location); @@ -14840,11 +14840,11 @@ makeColumnRef(char *colname, List *indirection, } =20 static Node * -makeTypeCast(Node *arg, TypeName *typename, int location) +makeTypeCast(Node *arg, TypeName *typname, int location) { TypeCast *n =3D makeNode(TypeCast); n->arg =3D arg; - n->typeName =3D typename; + n->typeName =3D typname; n->location =3D location; return (Node *) n; } @@ -14862,11 +14862,11 @@ makeStringConst(char *str, int location) } =20 static Node * -makeStringConstCast(char *str, int location, TypeName *typename) +makeStringConstCast(char *str, int location, TypeName *typname) { Node *s =3D makeStringConst(str, location); =20 - return makeTypeCast(s, typename, -1); + return makeTypeCast(s, typname, -1); } =20 static Node * diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_c= lause.c index b5eae56006..0c404a0fef 100644 --- a/src/backend/parser/parse_clause.c +++ b/src/backend/parser/parse_clause.c @@ -57,7 +57,7 @@ static Node *transformJoinUsingClause(ParseState *pstate, RangeTblEntry *leftRTE, RangeTblEntry *rightRTE, List *leftVars, List *rightVars); static Node *transformJoinOnClause(ParseState *pstate, JoinExpr *j, - List *namespace); + List *namespaces); static RangeTblEntry *transformTableEntry(ParseState *pstate, RangeVar *r); static RangeTblEntry *transformCTEReference(ParseState *pstate, RangeVar *= r, CommonTableExpr *cte, Index levelsup); @@ -69,14 +69,14 @@ static TableSampleClause *transformRangeTableSample(Par= seState *pstate, RangeTableSample *rts); static Node *transformFromClauseItem(ParseState *pstate, Node *n, RangeTblEntry **top_rte, int *top_rti, - List **namespace); + List **namespaces); static Node *buildMergedJoinVar(ParseState *pstate, JoinType jointype, Var *l_colvar, Var *r_colvar); static ParseNamespaceItem *makeNamespaceItem(RangeTblEntry *rte, bool rel_visible, bool cols_visible, bool lateral_only, bool lateral_ok); -static void setNamespaceColumnVisibility(List *namespace, bool cols_visibl= e); -static void setNamespaceLateralState(List *namespace, +static void setNamespaceColumnVisibility(List *namespaces, bool cols_visib= le); +static void setNamespaceLateralState(List *namespaces, bool lateral_only, bool lateral_ok); static void checkExprIsVarFree(ParseState *pstate, Node *n, const char *constructName); @@ -124,20 +124,20 @@ transformFromClause(ParseState *pstate, List *frmList) Node *n =3D lfirst(fl); RangeTblEntry *rte; int rtindex; - List *namespace; + List *namespaces; =20 n =3D transformFromClauseItem(pstate, n, &rte, &rtindex, - &namespace); + &namespaces); =20 - checkNameSpaceConflicts(pstate, pstate->p_namespace, namespace); + checkNameSpaceConflicts(pstate, pstate->p_namespace, namespaces); =20 /* Mark the new namespace items as visible only to LATERAL */ - setNamespaceLateralState(namespace, true, true); + setNamespaceLateralState(namespaces, true, true); =20 pstate->p_joinlist =3D lappend(pstate->p_joinlist, n); - pstate->p_namespace =3D list_concat(pstate->p_namespace, namespace); + pstate->p_namespace =3D list_concat(pstate->p_namespace, namespaces); } =20 /* @@ -376,7 +376,7 @@ transformJoinUsingClause(ParseState *pstate, * Result is a transformed qualification expression. */ static Node * -transformJoinOnClause(ParseState *pstate, JoinExpr *j, List *namespace) +transformJoinOnClause(ParseState *pstate, JoinExpr *j, List *namespaces) { Node *result; List *save_namespace; @@ -389,10 +389,10 @@ transformJoinOnClause(ParseState *pstate, JoinExpr *j= , List *namespace) * already did.) All namespace items are marked visible regardless of * LATERAL state. */ - setNamespaceLateralState(namespace, false, true); + setNamespaceLateralState(namespaces, false, true); =20 save_namespace =3D pstate->p_namespace; - pstate->p_namespace =3D namespace; + pstate->p_namespace =3D namespaces; =20 result =3D transformWhereClause(pstate, j->quals, EXPR_KIND_JOIN_ON, "JOIN/ON"); @@ -820,7 +820,7 @@ transformRangeTableSample(ParseState *pstate, RangeTabl= eSample *rts) static Node * transformFromClauseItem(ParseState *pstate, Node *n, RangeTblEntry **top_rte, int *top_rti, - List **namespace) + List **namespaces) { if (IsA(n, RangeVar)) { @@ -850,7 +850,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, Assert(rte =3D=3D rt_fetch(rtindex, pstate->p_rtable)); *top_rte =3D rte; *top_rti =3D rtindex; - *namespace =3D list_make1(makeDefaultNSItem(rte)); + *namespaces =3D list_make1(makeDefaultNSItem(rte)); rtr =3D makeNode(RangeTblRef); rtr->rtindex =3D rtindex; return (Node *) rtr; @@ -868,7 +868,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, Assert(rte =3D=3D rt_fetch(rtindex, pstate->p_rtable)); *top_rte =3D rte; *top_rti =3D rtindex; - *namespace =3D list_make1(makeDefaultNSItem(rte)); + *namespaces =3D list_make1(makeDefaultNSItem(rte)); rtr =3D makeNode(RangeTblRef); rtr->rtindex =3D rtindex; return (Node *) rtr; @@ -886,7 +886,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, Assert(rte =3D=3D rt_fetch(rtindex, pstate->p_rtable)); *top_rte =3D rte; *top_rti =3D rtindex; - *namespace =3D list_make1(makeDefaultNSItem(rte)); + *namespaces =3D list_make1(makeDefaultNSItem(rte)); rtr =3D makeNode(RangeTblRef); rtr->rtindex =3D rtindex; return (Node *) rtr; @@ -901,7 +901,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, =20 /* Recursively transform the contained relation */ rel =3D transformFromClauseItem(pstate, rts->relation, - top_rte, top_rti, namespace); + top_rte, top_rti, namespaces); /* Currently, grammar could only return a RangeVar as contained rel */ rtr =3D castNode(RangeTblRef, rel); rte =3D rt_fetch(rtr->rtindex, pstate->p_rtable); @@ -1230,7 +1230,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, * The join RTE itself is always made visible for unqualified column * names. It's visible as a relation name only if it has an alias. */ - *namespace =3D lappend(my_namespace, + *namespaces =3D lappend(my_namespace, makeNamespaceItem(rte, (j->alias !=3D NULL), true, @@ -1387,11 +1387,11 @@ makeNamespaceItem(RangeTblEntry *rte, bool rel_visi= ble, bool cols_visible, * Convenience subroutine to update cols_visible flags in a namespace li= st. */ static void -setNamespaceColumnVisibility(List *namespace, bool cols_visible) +setNamespaceColumnVisibility(List *namespaces, bool cols_visible) { ListCell *lc; =20 - foreach(lc, namespace) + foreach(lc, namespaces) { ParseNamespaceItem *nsitem =3D (ParseNamespaceItem *) lfirst(lc); =20 @@ -1404,11 +1404,11 @@ setNamespaceColumnVisibility(List *namespace, bool = cols_visible) * Convenience subroutine to update LATERAL flags in a namespace list. */ static void -setNamespaceLateralState(List *namespace, bool lateral_only, bool lateral_= ok) +setNamespaceLateralState(List *namespaces, bool lateral_only, bool lateral= _ok) { ListCell *lc; =20 - foreach(lc, namespace) + foreach(lc, namespaces) { ParseNamespaceItem *nsitem =3D (ParseNamespaceItem *) lfirst(lc); =20 diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_nod= e.c index 30cc7dadca..5a87e08d82 100644 --- a/src/backend/parser/parse_node.c +++ b/src/backend/parser/parse_node.c @@ -470,9 +470,9 @@ make_const(ParseState *pstate, Value *value, int locati= on) Const *con; Datum val; int64 val64; - Oid typeid; - int typelen; - bool typebyval; + Oid typid; + int typlen; + bool typbyval; ParseCallbackState pcbstate; =20 switch (nodeTag(value)) @@ -480,9 +480,9 @@ make_const(ParseState *pstate, Value *value, int locati= on) case T_Integer: val =3D Int32GetDatum(intVal(value)); =20 - typeid =3D INT4OID; - typelen =3D sizeof(int32); - typebyval =3D true; + typid =3D INT4OID; + typlen =3D sizeof(int32); + typbyval =3D true; break; =20 case T_Float: @@ -499,17 +499,17 @@ make_const(ParseState *pstate, Value *value, int loca= tion) { val =3D Int32GetDatum(val32); =20 - typeid =3D INT4OID; - typelen =3D sizeof(int32); - typebyval =3D true; + typid =3D INT4OID; + typlen =3D sizeof(int32); + typbyval =3D true; } else { val =3D Int64GetDatum(val64); =20 - typeid =3D INT8OID; - typelen =3D sizeof(int64); - typebyval =3D FLOAT8PASSBYVAL; /* int8 and float8 alike */ + typid =3D INT8OID; + typlen =3D sizeof(int64); + typbyval =3D FLOAT8PASSBYVAL; /* int8 and float8 alike */ } } else @@ -522,9 +522,9 @@ make_const(ParseState *pstate, Value *value, int locati= on) Int32GetDatum(-1)); cancel_parser_errposition_callback(&pcbstate); =20 - typeid =3D NUMERICOID; - typelen =3D -1; /* variable len */ - typebyval =3D false; + typid =3D NUMERICOID; + typlen =3D -1; /* variable len */ + typbyval =3D false; } break; =20 @@ -536,9 +536,9 @@ make_const(ParseState *pstate, Value *value, int locati= on) */ val =3D CStringGetDatum(strVal(value)); =20 - typeid =3D UNKNOWNOID; /* will be coerced later */ - typelen =3D -2; /* cstring-style varwidth type */ - typebyval =3D false; + typid =3D UNKNOWNOID; /* will be coerced later */ + typlen =3D -2; /* cstring-style varwidth type */ + typbyval =3D false; break; =20 case T_BitString: @@ -549,9 +549,9 @@ make_const(ParseState *pstate, Value *value, int locati= on) ObjectIdGetDatum(InvalidOid), Int32GetDatum(-1)); cancel_parser_errposition_callback(&pcbstate); - typeid =3D BITOID; - typelen =3D -1; - typebyval =3D false; + typid =3D BITOID; + typlen =3D -1; + typbyval =3D false; break; =20 case T_Null: @@ -571,13 +571,13 @@ make_const(ParseState *pstate, Value *value, int loca= tion) return NULL; /* keep compiler quiet */ } =20 - con =3D makeConst(typeid, + con =3D makeConst(typid, -1, /* typmod -1 is OK for all cases */ InvalidOid, /* all cases are uncollatable types */ - typelen, + typlen, val, false, - typebyval); + typbyval); con->location =3D location; =20 return con; diff --git a/src/backend/parser/scan.l b/src/backend/parser/scan.l index 634bfa512f..ef53cc4a67 100644 --- a/src/backend/parser/scan.l +++ b/src/backend/parser/scan.l @@ -1195,12 +1195,12 @@ static char * litbufdup(core_yyscan_t yyscanner) { int llen =3D yyextra->literallen; - char *new; + char *newbuf; =20 - new =3D palloc(llen + 1); - memcpy(new, yyextra->literalbuf, llen); - new[llen] =3D '\0'; - return new; + newbuf =3D palloc(llen + 1); + memcpy(newbuf, yyextra->literalbuf, llen); + newbuf[llen] =3D '\0'; + return newbuf; } =20 static int @@ -1307,7 +1307,7 @@ check_uescapechar(unsigned char escape) static char * litbuf_udeescape(unsigned char escape, core_yyscan_t yyscanner) { - char *new; + char *newbuf; char *litbuf, *in, *out; @@ -1321,10 +1321,10 @@ litbuf_udeescape(unsigned char escape, core_yyscan_= t yyscanner) * This relies on the subtle assumption that a UTF-8 expansion cannot be * longer than its escaped representation. */ - new =3D palloc(yyextra->literallen + 1); + newbuf =3D palloc(yyextra->literallen + 1); =20 in =3D litbuf; - out =3D new; + out =3D newbuf; while (*in) { if (in[0] =3D=3D escape) @@ -1449,8 +1449,8 @@ litbuf_udeescape(unsigned char escape, core_yyscan_t = yyscanner) * codes; but it's probably not worth the trouble, since this isn't likely * to be a performance-critical path. */ - pg_verifymbstr(new, out - new, false); - return new; + pg_verifymbstr(newbuf, out - newbuf, false); + return newbuf; } =20 static unsigned char diff --git a/src/backend/tcop/fastpath.c b/src/backend/tcop/fastpath.c index 2efed95132..124267f72d 100644 --- a/src/backend/tcop/fastpath.c +++ b/src/backend/tcop/fastpath.c @@ -51,7 +51,7 @@ struct fp_info { Oid funcid; FmgrInfo flinfo; /* function lookup info for funcid */ - Oid namespace; /* other stuff from pg_proc */ + Oid namespaceid; /* other stuff from pg_proc */ Oid rettype; Oid argtypes[FUNC_MAX_ARGS]; char fname[NAMEDATALEN]; /* function name for logging */ @@ -228,7 +228,7 @@ fetch_fp_info(Oid func_id, struct fp_info * fip) elog(ERROR, "function %s has more than %d arguments", NameStr(pp->proname), FUNC_MAX_ARGS); =20 - fip->namespace =3D pp->pronamespace; + fip->namespaceid =3D pp->pronamespace; fip->rettype =3D pp->prorettype; memcpy(fip->argtypes, pp->proargtypes.values, pp->pronargs * sizeof(Oid)); strlcpy(fip->fname, NameStr(pp->proname), NAMEDATALEN); @@ -325,11 +325,11 @@ HandleFunctionRequest(StringInfo msgBuf) * Check permission to access and call function. Since we didn't go * through a normal name lookup, we need to check schema usage too. */ - aclresult =3D pg_namespace_aclcheck(fip->namespace, GetUserId(), ACL_USAG= E); + aclresult =3D pg_namespace_aclcheck(fip->namespaceid, GetUserId(), ACL_US= AGE); if (aclresult !=3D ACLCHECK_OK) aclcheck_error(aclresult, ACL_KIND_NAMESPACE, - get_namespace_name(fip->namespace)); - InvokeNamespaceSearchHook(fip->namespace, true); + get_namespace_name(fip->namespaceid)); + InvokeNamespaceSearchHook(fip->namespaceid, true); =20 aclresult =3D pg_proc_aclcheck(fid, GetUserId(), ACL_EXECUTE); if (aclresult !=3D ACLCHECK_OK) diff --git a/src/backend/tsearch/spell.c b/src/backend/tsearch/spell.c index c1e194a8f5..c397033352 100644 --- a/src/backend/tsearch/spell.c +++ b/src/backend/tsearch/spell.c @@ -2388,7 +2388,7 @@ SplitToVariants(IspellDict *Conf, SPNode *snode, Spli= tVar *orig, char *word, int if (subres) { /* Yes, it was a word from dictionary */ - SplitVar *new =3D CopyVar(var, 0); + SplitVar *newvar =3D CopyVar(var, 0); SplitVar *ptr =3D var; char **sptr =3D subres; =20 @@ -2396,17 +2396,17 @@ SplitToVariants(IspellDict *Conf, SPNode *snode, Sp= litVar *orig, char *word, int =20 while (*sptr) { - AddStem(new, *sptr); + AddStem(newvar, *sptr); sptr++; } pfree(subres); =20 while (ptr->next) ptr =3D ptr->next; - ptr->next =3D SplitToVariants(Conf, NULL, new, word, wordlen, startpos= + lenaff, startpos + lenaff); + ptr->next =3D SplitToVariants(Conf, NULL, newvar, word, wordlen, start= pos + lenaff, startpos + lenaff); =20 - pfree(new->stem); - pfree(new); + pfree(newvar->stem); + pfree(newvar); } } =20 diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c index 96ac1dfefd..d74b5c2e66 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -113,7 +113,7 @@ static Oid convert_server_name(text *servername); static AclMode convert_server_priv_string(text *priv_type_text); static Oid convert_tablespace_name(text *tablespacename); static AclMode convert_tablespace_priv_string(text *priv_type_text); -static Oid convert_type_name(text *typename); +static Oid convert_type_name(text *typeName); static AclMode convert_type_priv_string(text *priv_type_text); static AclMode convert_role_priv_string(text *priv_type_text); static AclResult pg_role_aclcheck(Oid role_oid, Oid roleid, AclMode mode); @@ -4213,7 +4213,7 @@ Datum has_type_privilege_name_name(PG_FUNCTION_ARGS) { Name username =3D PG_GETARG_NAME(0); - text *typename =3D PG_GETARG_TEXT_P(1); + text *typname =3D PG_GETARG_TEXT_P(1); text *priv_type_text =3D PG_GETARG_TEXT_P(2); Oid roleid; Oid typeoid; @@ -4221,7 +4221,7 @@ has_type_privilege_name_name(PG_FUNCTION_ARGS) AclResult aclresult; =20 roleid =3D get_role_oid_or_public(NameStr(*username)); - typeoid =3D convert_type_name(typename); + typeoid =3D convert_type_name(typname); mode =3D convert_type_priv_string(priv_type_text); =20 aclresult =3D pg_type_aclcheck(typeoid, roleid, mode); @@ -4238,7 +4238,7 @@ has_type_privilege_name_name(PG_FUNCTION_ARGS) Datum has_type_privilege_name(PG_FUNCTION_ARGS) { - text *typename =3D PG_GETARG_TEXT_P(0); + text *typname =3D PG_GETARG_TEXT_P(0); text *priv_type_text =3D PG_GETARG_TEXT_P(1); Oid roleid; Oid typeoid; @@ -4246,7 +4246,7 @@ has_type_privilege_name(PG_FUNCTION_ARGS) AclResult aclresult; =20 roleid =3D GetUserId(); - typeoid =3D convert_type_name(typename); + typeoid =3D convert_type_name(typname); mode =3D convert_type_priv_string(priv_type_text); =20 aclresult =3D pg_type_aclcheck(typeoid, roleid, mode); @@ -4315,13 +4315,13 @@ Datum has_type_privilege_id_name(PG_FUNCTION_ARGS) { Oid roleid =3D PG_GETARG_OID(0); - text *typename =3D PG_GETARG_TEXT_P(1); + text *typname =3D PG_GETARG_TEXT_P(1); text *priv_type_text =3D PG_GETARG_TEXT_P(2); Oid typeoid; AclMode mode; AclResult aclresult; =20 - typeoid =3D convert_type_name(typename); + typeoid =3D convert_type_name(typname); mode =3D convert_type_priv_string(priv_type_text); =20 aclresult =3D pg_type_aclcheck(typeoid, roleid, mode); @@ -4361,9 +4361,9 @@ has_type_privilege_id_id(PG_FUNCTION_ARGS) * Given a type name expressed as a string, look it up and return Oid */ static Oid -convert_type_name(text *typename) +convert_type_name(text *typeName) { - char *typname =3D text_to_cstring(typename); + char *typname =3D text_to_cstring(typeName); Oid oid; =20 oid =3D DatumGetObjectId(DirectFunctionCall1(regtypein, diff --git a/src/backend/utils/adt/array_selfuncs.c b/src/backend/utils/adt= /array_selfuncs.c index 50e8145241..39ab45a839 100644 --- a/src/backend/utils/adt/array_selfuncs.c +++ b/src/backend/utils/adt/array_selfuncs.c @@ -40,22 +40,22 @@ DEFAULT_OVERLAP_SEL : DEFAULT_CONTAIN_SEL) =20 static Selectivity calc_arraycontsel(VariableStatData *vardata, Datum cons= tval, - Oid elemtype, Oid operator); + Oid elemtype, Oid opid); static Selectivity mcelem_array_selec(ArrayType *array, TypeCacheEntry *typentry, Datum *mcelem, int nmcelem, float4 *numbers, int nnumbers, float4 *hist, int nhist, - Oid operator, FmgrInfo *cmpfunc); + Oid opid, FmgrInfo *cmpfunc); static Selectivity mcelem_array_contain_overlap_selec(Datum *mcelem, int n= mcelem, float4 *numbers, int nnumbers, Datum *array_data, int nitems, - Oid operator, FmgrInfo *cmpfunc); + Oid opid, FmgrInfo *cmpfunc); static Selectivity mcelem_array_contained_selec(Datum *mcelem, int nmcelem, float4 *numbers, int nnumbers, Datum *array_data, int nitems, float4 *hist, int nhist, - Oid operator, FmgrInfo *cmpfunc); + Oid opid, FmgrInfo *cmpfunc); static float *calc_hist(const float4 *hist, int nhist, int n); static float *calc_distr(const float *p, int n, int m, float rest); static int floor_log2(uint32 n); @@ -251,7 +251,7 @@ Datum arraycontsel(PG_FUNCTION_ARGS) { PlannerInfo *root =3D (PlannerInfo *) PG_GETARG_POINTER(0); - Oid operator =3D PG_GETARG_OID(1); + Oid opid =3D PG_GETARG_OID(1); List *args =3D (List *) PG_GETARG_POINTER(2); int varRelid =3D PG_GETARG_INT32(3); VariableStatData vardata; @@ -266,7 +266,7 @@ arraycontsel(PG_FUNCTION_ARGS) */ if (!get_restriction_variable(root, args, varRelid, &vardata, &other, &varonleft)) - PG_RETURN_FLOAT8(DEFAULT_SEL(operator)); + PG_RETURN_FLOAT8(DEFAULT_SEL(opid)); =20 /* * Can't do anything useful if the something is not a constant, either. @@ -274,7 +274,7 @@ arraycontsel(PG_FUNCTION_ARGS) if (!IsA(other, Const)) { ReleaseVariableStats(vardata); - PG_RETURN_FLOAT8(DEFAULT_SEL(operator)); + PG_RETURN_FLOAT8(DEFAULT_SEL(opid)); } =20 /* @@ -293,10 +293,10 @@ arraycontsel(PG_FUNCTION_ARGS) */ if (!varonleft) { - if (operator =3D=3D OID_ARRAY_CONTAINS_OP) - operator =3D OID_ARRAY_CONTAINED_OP; - else if (operator =3D=3D OID_ARRAY_CONTAINED_OP) - operator =3D OID_ARRAY_CONTAINS_OP; + if (opid =3D=3D OID_ARRAY_CONTAINS_OP) + opid =3D OID_ARRAY_CONTAINED_OP; + else if (opid =3D=3D OID_ARRAY_CONTAINED_OP) + opid =3D OID_ARRAY_CONTAINS_OP; } =20 /* @@ -310,11 +310,11 @@ arraycontsel(PG_FUNCTION_ARGS) element_typeid =3D=3D get_base_element_type(vardata.vartype)) { selec =3D calc_arraycontsel(&vardata, ((Const *) other)->constvalue, - element_typeid, operator); + element_typeid, opid); } else { - selec =3D DEFAULT_SEL(operator); + selec =3D DEFAULT_SEL(opid); } =20 ReleaseVariableStats(vardata); @@ -331,9 +331,9 @@ Datum arraycontjoinsel(PG_FUNCTION_ARGS) { /* For the moment this is just a stub */ - Oid operator =3D PG_GETARG_OID(1); + Oid opid =3D PG_GETARG_OID(1); =20 - PG_RETURN_FLOAT8(DEFAULT_SEL(operator)); + PG_RETURN_FLOAT8(DEFAULT_SEL(opid)); } =20 /* @@ -345,7 +345,7 @@ arraycontjoinsel(PG_FUNCTION_ARGS) */ static Selectivity calc_arraycontsel(VariableStatData *vardata, Datum constval, - Oid elemtype, Oid operator) + Oid elemtype, Oid opid) { Selectivity selec; TypeCacheEntry *typentry; @@ -355,7 +355,7 @@ calc_arraycontsel(VariableStatData *vardata, Datum cons= tval, /* Get element type's default comparison function */ typentry =3D lookup_type_cache(elemtype, TYPECACHE_CMP_PROC_FINFO); if (!OidIsValid(typentry->cmp_proc_finfo.fn_oid)) - return DEFAULT_SEL(operator); + return DEFAULT_SEL(opid); cmpfunc =3D &typentry->cmp_proc_finfo; =20 /* @@ -388,7 +388,7 @@ calc_arraycontsel(VariableStatData *vardata, Datum cons= tval, * For "array <@ const" case we also need histogram of distinct * element counts. */ - if (operator !=3D OID_ARRAY_CONTAINED_OP || + if (opid !=3D OID_ARRAY_CONTAINED_OP || !get_attstatsslot(vardata->statsTuple, elemtype, vardata->atttypmod, STATISTIC_KIND_DECHIST, InvalidOid, @@ -405,7 +405,7 @@ calc_arraycontsel(VariableStatData *vardata, Datum cons= tval, values, nvalues, numbers, nnumbers, hist, nhist, - operator, cmpfunc); + opid, cmpfunc); =20 if (hist) free_attstatsslot(elemtype, NULL, 0, hist, nhist); @@ -416,7 +416,7 @@ calc_arraycontsel(VariableStatData *vardata, Datum cons= tval, /* No most-common-elements info, so do without */ selec =3D mcelem_array_selec(array, typentry, NULL, 0, NULL, 0, NULL, 0, - operator, cmpfunc); + opid, cmpfunc); } =20 /* @@ -429,7 +429,7 @@ calc_arraycontsel(VariableStatData *vardata, Datum cons= tval, /* No stats at all, so do without */ selec =3D mcelem_array_selec(array, typentry, NULL, 0, NULL, 0, NULL, 0, - operator, cmpfunc); + opid, cmpfunc); /* we assume no nulls here, so no stanullfrac correction */ } =20 @@ -452,7 +452,7 @@ mcelem_array_selec(ArrayType *array, TypeCacheEntry *ty= pentry, Datum *mcelem, int nmcelem, float4 *numbers, int nnumbers, float4 *hist, int nhist, - Oid operator, FmgrInfo *cmpfunc) + Oid opid, FmgrInfo *cmpfunc) { Selectivity selec; int num_elems; @@ -488,7 +488,7 @@ mcelem_array_selec(ArrayType *array, TypeCacheEntry *ty= pentry, * Query "column @> '{anything, null}'" matches nothing. For the other * two operators, presence of a null in the constant can be ignored. */ - if (null_present && operator =3D=3D OID_ARRAY_CONTAINS_OP) + if (null_present && opid =3D=3D OID_ARRAY_CONTAINS_OP) { pfree(elem_values); pfree(elem_nulls); @@ -500,21 +500,21 @@ mcelem_array_selec(ArrayType *array, TypeCacheEntry *= typentry, element_compare, cmpfunc); =20 /* Separate cases according to operator */ - if (operator =3D=3D OID_ARRAY_CONTAINS_OP || operator =3D=3D OID_ARRAY_OV= ERLAP_OP) + if (opid =3D=3D OID_ARRAY_CONTAINS_OP || opid =3D=3D OID_ARRAY_OVERLAP_OP) selec =3D mcelem_array_contain_overlap_selec(mcelem, nmcelem, numbers, nnumbers, elem_values, nonnull_nitems, - operator, cmpfunc); - else if (operator =3D=3D OID_ARRAY_CONTAINED_OP) + opid, cmpfunc); + else if (opid =3D=3D OID_ARRAY_CONTAINED_OP) selec =3D mcelem_array_contained_selec(mcelem, nmcelem, numbers, nnumbers, elem_values, nonnull_nitems, hist, nhist, - operator, cmpfunc); + opid, cmpfunc); else { elog(ERROR, "arraycontsel called for unrecognized operator %u", - operator); + opid); selec =3D 0.0; /* keep compiler quiet */ } =20 @@ -544,7 +544,7 @@ static Selectivity mcelem_array_contain_overlap_selec(Datum *mcelem, int nmcelem, float4 *numbers, int nnumbers, Datum *array_data, int nitems, - Oid operator, FmgrInfo *cmpfunc) + Oid opid, FmgrInfo *cmpfunc) { Selectivity selec, elem_selec; @@ -582,7 +582,7 @@ mcelem_array_contain_overlap_selec(Datum *mcelem, int n= mcelem, else use_bsearch =3D false; =20 - if (operator =3D=3D OID_ARRAY_CONTAINS_OP) + if (opid =3D=3D OID_ARRAY_CONTAINS_OP) { /* * Initial selectivity for "column @> const" query is 1.0, and it will @@ -654,7 +654,7 @@ mcelem_array_contain_overlap_selec(Datum *mcelem, int n= mcelem, * Update overall selectivity using the current element's selectivity * and an assumption of element occurrence independence. */ - if (operator =3D=3D OID_ARRAY_CONTAINS_OP) + if (opid =3D=3D OID_ARRAY_CONTAINS_OP) selec *=3D elem_selec; else selec =3D selec + elem_selec - selec * elem_selec; @@ -720,7 +720,7 @@ mcelem_array_contained_selec(Datum *mcelem, int nmcelem, float4 *numbers, int nnumbers, Datum *array_data, int nitems, float4 *hist, int nhist, - Oid operator, FmgrInfo *cmpfunc) + Oid opid, FmgrInfo *cmpfunc) { int mcelem_index, i, diff --git a/src/backend/utils/adt/format_type.c b/src/backend/utils/adt/fo= rmat_type.c index 00bfaca59e..fccd1d4f18 100644 --- a/src/backend/utils/adt/format_type.c +++ b/src/backend/utils/adt/format_type.c @@ -437,9 +437,9 @@ oidvectortypes(PG_FUNCTION_ARGS) =20 for (num =3D 0; num < numargs; num++) { - char *typename =3D format_type_internal(oidArray->values[num], -1, + char *typname =3D format_type_internal(oidArray->values[num], -1, false, true, false); - size_t slen =3D strlen(typename); + size_t slen =3D strlen(typname); =20 if (left < (slen + 2)) { @@ -453,7 +453,7 @@ oidvectortypes(PG_FUNCTION_ARGS) strcat(result, ", "); left -=3D 2; } - strcat(result, typename); + strcat(result, typname); left -=3D slen; } =20 diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c index 0116fa08a6..54e6d768ff 100644 --- a/src/backend/utils/adt/misc.c +++ b/src/backend/utils/adt/misc.c @@ -651,17 +651,17 @@ pg_typeof(PG_FUNCTION_ARGS) Datum pg_collation_for(PG_FUNCTION_ARGS) { - Oid typeid; + Oid typid; Oid collid; =20 - typeid =3D get_fn_expr_argtype(fcinfo->flinfo, 0); - if (!typeid) + typid =3D get_fn_expr_argtype(fcinfo->flinfo, 0); + if (!typid) PG_RETURN_NULL(); - if (!type_is_collatable(typeid) && typeid !=3D UNKNOWNOID) + if (!type_is_collatable(typid) && typid !=3D UNKNOWNOID) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("collations are not supported by type %s", - format_type_be(typeid)))); + format_type_be(typid)))); =20 collid =3D PG_GET_COLLATION(); if (!collid) diff --git a/src/backend/utils/adt/network_gist.c b/src/backend/utils/adt/n= etwork_gist.c index a0097dae9c..4c6a6b2d81 100644 --- a/src/backend/utils/adt/network_gist.c +++ b/src/backend/utils/adt/network_gist.c @@ -629,17 +629,17 @@ inet_gist_penalty(PG_FUNCTION_ARGS) GISTENTRY *origent =3D (GISTENTRY *) PG_GETARG_POINTER(0); GISTENTRY *newent =3D (GISTENTRY *) PG_GETARG_POINTER(1); float *penalty =3D (float *) PG_GETARG_POINTER(2); - GistInetKey *orig =3D DatumGetInetKeyP(origent->key), - *new =3D DatumGetInetKeyP(newent->key); + GistInetKey *origkey =3D DatumGetInetKeyP(origent->key), + *newkey =3D DatumGetInetKeyP(newent->key); int commonbits; =20 - if (gk_ip_family(orig) =3D=3D gk_ip_family(new)) + if (gk_ip_family(origkey) =3D=3D gk_ip_family(newkey)) { - if (gk_ip_minbits(orig) <=3D gk_ip_minbits(new)) + if (gk_ip_minbits(origkey) <=3D gk_ip_minbits(newkey)) { - commonbits =3D bitncommon(gk_ip_addr(orig), gk_ip_addr(new), - Min(gk_ip_commonbits(orig), - gk_ip_commonbits(new))); + commonbits =3D bitncommon(gk_ip_addr(origkey), gk_ip_addr(newkey), + Min(gk_ip_commonbits(origkey), + gk_ip_commonbits(newkey))); if (commonbits > 0) *penalty =3D 1.0f / commonbits; else diff --git a/src/backend/utils/adt/network_selfuncs.c b/src/backend/utils/a= dt/network_selfuncs.c index bcdd902ee8..2bcd16f356 100644 --- a/src/backend/utils/adt/network_selfuncs.c +++ b/src/backend/utils/adt/network_selfuncs.c @@ -43,16 +43,16 @@ /* Maximum number of items to consider in join selectivity calculations */ #define MAX_CONSIDERED_ELEMS 1024 =20 -static Selectivity networkjoinsel_inner(Oid operator, +static Selectivity networkjoinsel_inner(Oid opid, VariableStatData *vardata1, VariableStatData *vardata2); -static Selectivity networkjoinsel_semi(Oid operator, +static Selectivity networkjoinsel_semi(Oid opid, VariableStatData *vardata1, VariableStatData *vardata2); static Selectivity mcv_population(float4 *mcv_numbers, int mcv_nvalues); static Selectivity inet_hist_value_sel(Datum *values, int nvalues, Datum constvalue, int opr_codenum); static Selectivity inet_mcv_join_sel(Datum *mcv1_values, float4 *mcv1_numbers, int mcv1_nvalues, Datum *mcv2_values, - float4 *mcv2_numbers, int mcv2_nvalues, Oid operator); + float4 *mcv2_numbers, int mcv2_nvalues, Oid opid); static Selectivity inet_mcv_hist_sel(Datum *mcv_values, float4 *mcv_number= s, int mcv_nvalues, Datum *hist_values, int hist_nvalues, int opr_codenum); @@ -65,7 +65,7 @@ static Selectivity inet_semi_join_sel(Datum lhs_value, bool hist_exists, Datum *hist_values, int hist_nvalues, double hist_weight, FmgrInfo *proc, int opr_codenum); -static int inet_opr_codenum(Oid operator); +static int inet_opr_codenum(Oid opid); static int inet_inclusion_cmp(inet *left, inet *right, int opr_codenum); static int inet_masklen_inclusion_cmp(inet *left, inet *right, int opr_codenum); @@ -79,7 +79,7 @@ Datum networksel(PG_FUNCTION_ARGS) { PlannerInfo *root =3D (PlannerInfo *) PG_GETARG_POINTER(0); - Oid operator =3D PG_GETARG_OID(1); + Oid opid =3D PG_GETARG_OID(1); List *args =3D (List *) PG_GETARG_POINTER(2); int varRelid =3D PG_GETARG_INT32(3); VariableStatData vardata; @@ -102,7 +102,7 @@ networksel(PG_FUNCTION_ARGS) */ if (!get_restriction_variable(root, args, varRelid, &vardata, &other, &varonleft)) - PG_RETURN_FLOAT8(DEFAULT_SEL(operator)); + PG_RETURN_FLOAT8(DEFAULT_SEL(opid)); =20 /* * Can't do anything useful if the something is not a constant, either. @@ -110,7 +110,7 @@ networksel(PG_FUNCTION_ARGS) if (!IsA(other, Const)) { ReleaseVariableStats(vardata); - PG_RETURN_FLOAT8(DEFAULT_SEL(operator)); + PG_RETURN_FLOAT8(DEFAULT_SEL(opid)); } =20 /* All of the operators handled here are strict. */ @@ -125,7 +125,7 @@ networksel(PG_FUNCTION_ARGS) if (!HeapTupleIsValid(vardata.statsTuple)) { ReleaseVariableStats(vardata); - PG_RETURN_FLOAT8(DEFAULT_SEL(operator)); + PG_RETURN_FLOAT8(DEFAULT_SEL(opid)); } =20 stats =3D (Form_pg_statistic) GETSTRUCT(vardata.statsTuple); @@ -137,7 +137,7 @@ networksel(PG_FUNCTION_ARGS) * to the result selectivity. Also add up the total fraction represented * by MCV entries. */ - fmgr_info(get_opcode(operator), &proc); + fmgr_info(get_opcode(opid), &proc); mcv_selec =3D mcv_selectivity(&vardata, &proc, constvalue, varonleft, &sumcommon); =20 @@ -153,7 +153,7 @@ networksel(PG_FUNCTION_ARGS) &hist_values, &hist_nvalues, NULL, NULL)) { - int opr_codenum =3D inet_opr_codenum(operator); + int opr_codenum =3D inet_opr_codenum(opid); =20 /* Commute if needed, so we can consider histogram to be on the left */ if (!varonleft) @@ -164,7 +164,7 @@ networksel(PG_FUNCTION_ARGS) free_attstatsslot(vardata.atttype, hist_values, hist_nvalues, NULL, 0); } else - non_mcv_selec =3D DEFAULT_SEL(operator); + non_mcv_selec =3D DEFAULT_SEL(opid); =20 /* Combine selectivities for MCV and non-MCV populations */ selec =3D mcv_selec + (1.0 - nullfrac - sumcommon) * non_mcv_selec; @@ -199,7 +199,7 @@ Datum networkjoinsel(PG_FUNCTION_ARGS) { PlannerInfo *root =3D (PlannerInfo *) PG_GETARG_POINTER(0); - Oid operator =3D PG_GETARG_OID(1); + Oid opid =3D PG_GETARG_OID(1); List *args =3D (List *) PG_GETARG_POINTER(2); #ifdef NOT_USED JoinType jointype =3D (JoinType) PG_GETARG_INT16(3); @@ -223,15 +223,15 @@ networkjoinsel(PG_FUNCTION_ARGS) * Selectivity for left/full join is not exactly the same as inner * join, but we neglect the difference, as eqjoinsel does. */ - selec =3D networkjoinsel_inner(operator, &vardata1, &vardata2); + selec =3D networkjoinsel_inner(opid, &vardata1, &vardata2); break; case JOIN_SEMI: case JOIN_ANTI: /* Here, it's important that we pass the outer var on the left. */ if (!join_is_reversed) - selec =3D networkjoinsel_semi(operator, &vardata1, &vardata2); + selec =3D networkjoinsel_semi(opid, &vardata1, &vardata2); else - selec =3D networkjoinsel_semi(get_commutator(operator), + selec =3D networkjoinsel_semi(get_commutator(opid), &vardata2, &vardata1); break; default: @@ -263,7 +263,7 @@ networkjoinsel(PG_FUNCTION_ARGS) * Also, MCV vs histogram selectivity is not neglected as in eqjoinsel_inn= er(). */ static Selectivity -networkjoinsel_inner(Oid operator, +networkjoinsel_inner(Oid opid, VariableStatData *vardata1, VariableStatData *vardata2) { Form_pg_statistic stats; @@ -338,7 +338,7 @@ networkjoinsel_inner(Oid operator, sumcommon2 =3D mcv_population(mcv2_numbers, mcv2_length); } =20 - opr_codenum =3D inet_opr_codenum(operator); + opr_codenum =3D inet_opr_codenum(opid); =20 /* * Calculate selectivity for MCV vs MCV matches. @@ -346,7 +346,7 @@ networkjoinsel_inner(Oid operator, if (mcv1_exists && mcv2_exists) selec +=3D inet_mcv_join_sel(mcv1_values, mcv1_numbers, mcv1_length, mcv2_values, mcv2_numbers, mcv2_length, - operator); + opid); =20 /* * Add in selectivities for MCV vs histogram matches, scaling according to @@ -380,7 +380,7 @@ networkjoinsel_inner(Oid operator, * We can apply null fractions if known, though. */ if ((!mcv1_exists && !hist1_exists) || (!mcv2_exists && !hist2_exists)) - selec =3D (1.0 - nullfrac1) * (1.0 - nullfrac2) * DEFAULT_SEL(operator); + selec =3D (1.0 - nullfrac1) * (1.0 - nullfrac2) * DEFAULT_SEL(opid); =20 /* Release stats. */ if (mcv1_exists) @@ -406,7 +406,7 @@ networkjoinsel_inner(Oid operator, * histogram selectivity for semi/anti join cases. */ static Selectivity -networkjoinsel_semi(Oid operator, +networkjoinsel_semi(Oid opid, VariableStatData *vardata1, VariableStatData *vardata2) { Form_pg_statistic stats; @@ -484,8 +484,8 @@ networkjoinsel_semi(Oid operator, sumcommon2 =3D mcv_population(mcv2_numbers, mcv2_length); } =20 - opr_codenum =3D inet_opr_codenum(operator); - fmgr_info(get_opcode(operator), &proc); + opr_codenum =3D inet_opr_codenum(opid); + fmgr_info(get_opcode(opid), &proc); =20 /* Estimate number of input rows represented by RHS histogram. */ if (hist2_exists && vardata2->rel) @@ -547,7 +547,7 @@ networkjoinsel_semi(Oid operator, * We can apply null fractions if known, though. */ if ((!mcv1_exists && !hist1_exists) || (!mcv2_exists && !hist2_exists)) - selec =3D (1.0 - nullfrac1) * (1.0 - nullfrac2) * DEFAULT_SEL(operator); + selec =3D (1.0 - nullfrac1) * (1.0 - nullfrac2) * DEFAULT_SEL(opid); =20 /* Release stats. */ if (mcv1_exists) @@ -707,14 +707,14 @@ inet_hist_value_sel(Datum *values, int nvalues, Datum= constvalue, static Selectivity inet_mcv_join_sel(Datum *mcv1_values, float4 *mcv1_numbers, int mcv1_nvalu= es, Datum *mcv2_values, float4 *mcv2_numbers, int mcv2_nvalues, - Oid operator) + Oid opid) { Selectivity selec =3D 0.0; FmgrInfo proc; int i, j; =20 - fmgr_info(get_opcode(operator), &proc); + fmgr_info(get_opcode(opid), &proc); =20 for (i =3D 0; i < mcv1_nvalues; i++) { @@ -868,9 +868,9 @@ inet_semi_join_sel(Datum lhs_value, * operator. */ static int -inet_opr_codenum(Oid operator) +inet_opr_codenum(Oid opid) { - switch (operator) + switch (opid) { case OID_INET_SUP_OP: return -2; @@ -884,7 +884,7 @@ inet_opr_codenum(Oid operator) return 2; default: elog(ERROR, "unrecognized operator %u for inet selectivity", - operator); + opid); } return 0; /* unreached, but keep compiler quiet */ } diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeri= c.c index 781c713f81..d0439d319b 100644 --- a/src/backend/utils/adt/numeric.c +++ b/src/backend/utils/adt/numeric.c @@ -934,7 +934,7 @@ numeric (PG_FUNCTION_ARGS) { Numeric num =3D PG_GETARG_NUMERIC(0); int32 typmod =3D PG_GETARG_INT32(1); - Numeric new; + Numeric newnum; int32 tmp_typmod; int precision; int scale; @@ -954,9 +954,9 @@ numeric (PG_FUNCTION_ARGS) */ if (typmod < (int32) (VARHDRSZ)) { - new =3D (Numeric) palloc(VARSIZE(num)); - memcpy(new, num, VARSIZE(num)); - PG_RETURN_NUMERIC(new); + newnum =3D (Numeric) palloc(VARSIZE(num)); + memcpy(newnum, num, VARSIZE(num)); + PG_RETURN_NUMERIC(newnum); } =20 /* @@ -979,16 +979,16 @@ numeric (PG_FUNCTION_ARGS) && (NUMERIC_CAN_BE_SHORT(scale, NUMERIC_WEIGHT(num)) || !NUMERIC_IS_SHORT(num))) { - new =3D (Numeric) palloc(VARSIZE(num)); - memcpy(new, num, VARSIZE(num)); + newnum =3D (Numeric) palloc(VARSIZE(num)); + memcpy(newnum, num, VARSIZE(num)); if (NUMERIC_IS_SHORT(num)) - new->choice.n_short.n_header =3D + newnum->choice.n_short.n_header =3D (num->choice.n_short.n_header & ~NUMERIC_SHORT_DSCALE_MASK) | (scale << NUMERIC_SHORT_DSCALE_SHIFT); else - new->choice.n_long.n_sign_dscale =3D NUMERIC_SIGN(new) | + newnum->choice.n_long.n_sign_dscale =3D NUMERIC_SIGN(newnum) | ((uint16) scale & NUMERIC_DSCALE_MASK); - PG_RETURN_NUMERIC(new); + PG_RETURN_NUMERIC(newnum); } =20 /* @@ -999,11 +999,11 @@ numeric (PG_FUNCTION_ARGS) =20 set_var_from_num(num, &var); apply_typmod(&var, typmod); - new =3D make_result(&var); + newnum =3D make_result(&var); =20 free_var(&var); =20 - PG_RETURN_NUMERIC(new); + PG_RETURN_NUMERIC(newnum); } =20 Datum diff --git a/src/backend/utils/adt/rangetypes_gist.c b/src/backend/utils/ad= t/rangetypes_gist.c index f81b16c236..9f5390f34b 100644 --- a/src/backend/utils/adt/rangetypes_gist.c +++ b/src/backend/utils/adt/rangetypes_gist.c @@ -257,8 +257,8 @@ range_gist_penalty(PG_FUNCTION_ARGS) GISTENTRY *origentry =3D (GISTENTRY *) PG_GETARG_POINTER(0); GISTENTRY *newentry =3D (GISTENTRY *) PG_GETARG_POINTER(1); float *penalty =3D (float *) PG_GETARG_POINTER(2); - RangeType *orig =3D DatumGetRangeType(origentry->key); - RangeType *new =3D DatumGetRangeType(newentry->key); + RangeType *origkey =3D DatumGetRangeType(origentry->key); + RangeType *newkey =3D DatumGetRangeType(newentry->key); TypeCacheEntry *typcache; bool has_subtype_diff; RangeBound orig_lower, @@ -268,15 +268,15 @@ range_gist_penalty(PG_FUNCTION_ARGS) bool orig_empty, new_empty; =20 - if (RangeTypeGetOid(orig) !=3D RangeTypeGetOid(new)) + if (RangeTypeGetOid(origkey) !=3D RangeTypeGetOid(newkey)) elog(ERROR, "range types do not match"); =20 - typcache =3D range_get_typcache(fcinfo, RangeTypeGetOid(orig)); + typcache =3D range_get_typcache(fcinfo, RangeTypeGetOid(origkey)); =20 has_subtype_diff =3D OidIsValid(typcache->rng_subdiff_finfo.fn_oid); =20 - range_deserialize(typcache, orig, &orig_lower, &orig_upper, &orig_empty); - range_deserialize(typcache, new, &new_lower, &new_upper, &new_empty); + range_deserialize(typcache, origkey, &orig_lower, &orig_upper, &orig_empt= y); + range_deserialize(typcache, newkey, &new_lower, &new_upper, &new_empty); =20 /* * Distinct branches for handling distinct classes of ranges. Note that @@ -295,7 +295,7 @@ range_gist_penalty(PG_FUNCTION_ARGS) */ *penalty =3D 0.0; } - else if (RangeIsOrContainsEmpty(orig)) + else if (RangeIsOrContainsEmpty(origkey)) { /* * The second case is to insert empty range into range which @@ -356,7 +356,7 @@ range_gist_penalty(PG_FUNCTION_ARGS) *penalty =3D 2 * INFINITE_BOUND_PENALTY; } =20 - if (RangeIsOrContainsEmpty(orig)) + if (RangeIsOrContainsEmpty(origkey)) { /* * Original range is narrower when it doesn't contain empty @@ -952,17 +952,17 @@ range_gist_class_split(TypeCacheEntry *typcache, for (i =3D FirstOffsetNumber; i <=3D maxoff; i =3D OffsetNumberNext(i)) { RangeType *range =3D DatumGetRangeType(entryvec->vector[i].key); - int class; + int classNumber; =20 /* Get class of range */ - class =3D get_gist_range_class(range); + classNumber =3D get_gist_range_class(range); =20 /* Place range to appropriate page */ - if (classes_groups[class] =3D=3D SPLIT_LEFT) + if (classes_groups[classNumber] =3D=3D SPLIT_LEFT) PLACE_LEFT(range, i); else { - Assert(classes_groups[class] =3D=3D SPLIT_RIGHT); + Assert(classes_groups[classNumber] =3D=3D SPLIT_RIGHT); PLACE_RIGHT(range, i); } } diff --git a/src/backend/utils/adt/rangetypes_selfuncs.c b/src/backend/util= s/adt/rangetypes_selfuncs.c index 2997edd672..0b05df1214 100644 --- a/src/backend/utils/adt/rangetypes_selfuncs.c +++ b/src/backend/utils/adt/rangetypes_selfuncs.c @@ -27,11 +27,11 @@ #include "utils/typcache.h" =20 static double calc_rangesel(TypeCacheEntry *typcache, VariableStatData *va= rdata, - RangeType *constval, Oid operator); -static double default_range_selectivity(Oid operator); + RangeType *constval, Oid opid); +static double default_range_selectivity(Oid opid); static double calc_hist_selectivity(TypeCacheEntry *typcache, VariableStatData *vardata, RangeType *constval, - Oid operator); + Oid opid); static double calc_hist_selectivity_scalar(TypeCacheEntry *typcache, RangeBound *constbound, RangeBound *hist, int hist_nvalues, @@ -61,9 +61,9 @@ static double calc_hist_selectivity_contains(TypeCacheEnt= ry *typcache, * have statistics or cannot use them for some reason. */ static double -default_range_selectivity(Oid operator) +default_range_selectivity(Oid opid) { - switch (operator) + switch (opid) { case OID_RANGE_OVERLAP_OP: return 0.01; @@ -105,7 +105,7 @@ Datum rangesel(PG_FUNCTION_ARGS) { PlannerInfo *root =3D (PlannerInfo *) PG_GETARG_POINTER(0); - Oid operator =3D PG_GETARG_OID(1); + Oid opid =3D PG_GETARG_OID(1); List *args =3D (List *) PG_GETARG_POINTER(2); int varRelid =3D PG_GETARG_INT32(3); VariableStatData vardata; @@ -121,7 +121,7 @@ rangesel(PG_FUNCTION_ARGS) */ if (!get_restriction_variable(root, args, varRelid, &vardata, &other, &varonleft)) - PG_RETURN_FLOAT8(default_range_selectivity(operator)); + PG_RETURN_FLOAT8(default_range_selectivity(opid)); =20 /* * Can't do anything useful if the something is not a constant, either. @@ -129,7 +129,7 @@ rangesel(PG_FUNCTION_ARGS) if (!IsA(other, Const)) { ReleaseVariableStats(vardata); - PG_RETURN_FLOAT8(default_range_selectivity(operator)); + PG_RETURN_FLOAT8(default_range_selectivity(opid)); } =20 /* @@ -149,12 +149,12 @@ rangesel(PG_FUNCTION_ARGS) if (!varonleft) { /* we have other Op var, commute to make var Op other */ - operator =3D get_commutator(operator); - if (!operator) + opid =3D get_commutator(opid); + if (!opid) { /* Use default selectivity (should we raise an error instead?) */ ReleaseVariableStats(vardata); - PG_RETURN_FLOAT8(default_range_selectivity(operator)); + PG_RETURN_FLOAT8(default_range_selectivity(opid)); } } =20 @@ -169,7 +169,7 @@ rangesel(PG_FUNCTION_ARGS) * only that single point, so that we don't need special handling for that * in what follows. */ - if (operator =3D=3D OID_RANGE_CONTAINS_ELEM_OP) + if (opid =3D=3D OID_RANGE_CONTAINS_ELEM_OP) { typcache =3D range_get_typcache(fcinfo, vardata.vartype); =20 @@ -189,7 +189,7 @@ rangesel(PG_FUNCTION_ARGS) constrange =3D range_serialize(typcache, &lower, &upper, false); } } - else if (operator =3D=3D OID_RANGE_ELEM_CONTAINED_OP) + else if (opid =3D=3D OID_RANGE_ELEM_CONTAINED_OP) { /* * Here, the Var is the elem, not the range. For now we just punt and @@ -212,9 +212,9 @@ rangesel(PG_FUNCTION_ARGS) * OID_RANGE_ELEM_CONTAINED_OP. */ if (constrange) - selec =3D calc_rangesel(typcache, &vardata, constrange, operator); + selec =3D calc_rangesel(typcache, &vardata, constrange, opid); else - selec =3D default_range_selectivity(operator); + selec =3D default_range_selectivity(opid); =20 ReleaseVariableStats(vardata); =20 @@ -225,7 +225,7 @@ rangesel(PG_FUNCTION_ARGS) =20 static double calc_rangesel(TypeCacheEntry *typcache, VariableStatData *vardata, - RangeType *constval, Oid operator) + RangeType *constval, Oid opid) { double hist_selec; double selec; @@ -280,7 +280,7 @@ calc_rangesel(TypeCacheEntry *typcache, VariableStatDat= a *vardata, * An empty range matches all ranges, all empty ranges, or nothing, * depending on the operator */ - switch (operator) + switch (opid) { /* these return false if either argument is empty */ case OID_RANGE_OVERLAP_OP: @@ -315,7 +315,7 @@ calc_rangesel(TypeCacheEntry *typcache, VariableStatDat= a *vardata, /* an element cannot be empty */ case OID_RANGE_CONTAINS_ELEM_OP: default: - elog(ERROR, "unexpected operator %u", operator); + elog(ERROR, "unexpected operator %u", opid); selec =3D 0.0; /* keep compiler quiet */ break; } @@ -331,16 +331,16 @@ calc_rangesel(TypeCacheEntry *typcache, VariableStatD= ata *vardata, * NULL tuples, if we had statistics for them. */ hist_selec =3D calc_hist_selectivity(typcache, vardata, constval, - operator); + opid); if (hist_selec < 0.0) - hist_selec =3D default_range_selectivity(operator); + hist_selec =3D default_range_selectivity(opid); =20 /* * Now merge the results for the empty ranges and histogram * calculations, realizing that the histogram covers only the * non-null, non-empty values. */ - if (operator =3D=3D OID_RANGE_CONTAINED_OP) + if (opid =3D=3D OID_RANGE_CONTAINED_OP) { /* empty is contained by anything non-empty */ selec =3D (1.0 - empty_frac) * hist_selec + empty_frac; @@ -369,7 +369,7 @@ calc_rangesel(TypeCacheEntry *typcache, VariableStatDat= a *vardata, */ static double calc_hist_selectivity(TypeCacheEntry *typcache, VariableStatData *vardata, - RangeType *constval, Oid operator) + RangeType *constval, Oid opid) { Datum *hist_values; int nhist; @@ -409,8 +409,8 @@ calc_hist_selectivity(TypeCacheEntry *typcache, Variabl= eStatData *vardata, } =20 /* @> and @< also need a histogram of range lengths */ - if (operator =3D=3D OID_RANGE_CONTAINS_OP || - operator =3D=3D OID_RANGE_CONTAINED_OP) + if (opid =3D=3D OID_RANGE_CONTAINS_OP || + opid =3D=3D OID_RANGE_CONTAINED_OP) { if (!(HeapTupleIsValid(vardata->statsTuple) && get_attstatsslot(vardata->statsTuple, @@ -435,7 +435,7 @@ calc_hist_selectivity(TypeCacheEntry *typcache, Variabl= eStatData *vardata, * Calculate selectivity comparing the lower or upper bound of the * constant with the histogram of lower or upper bounds. */ - switch (operator) + switch (opid) { case OID_RANGE_LESS_OP: =20 @@ -555,7 +555,7 @@ calc_hist_selectivity(TypeCacheEntry *typcache, Variabl= eStatData *vardata, break; =20 default: - elog(ERROR, "unknown range operator %u", operator); + elog(ERROR, "unknown range operator %u", opid); hist_selec =3D -1.0; /* keep compiler quiet */ break; } diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regpro= c.c index fa920c0d8c..a75f054e9c 100644 --- a/src/backend/utils/adt/regproc.c +++ b/src/backend/utils/adt/regproc.c @@ -1881,11 +1881,11 @@ parseNameAndArgTypes(const char *string, bool allow= None, List **names, char *rawname; char *ptr; char *ptr2; - char *typename; + char *typname; bool in_quote; bool had_comma; int paren_count; - Oid typeid; + Oid typid; int32 typmod; =20 /* We need a modifiable copy of the input string. */ @@ -1941,7 +1941,7 @@ parseNameAndArgTypes(const char *string, bool allowNo= ne, List **names, errmsg("expected a type name"))); break; } - typename =3D ptr; + typname =3D ptr; /* Find end of type name --- end of string or comma */ /* ... but not a quoted or parenthesized comma */ in_quote =3D false; @@ -1984,30 +1984,30 @@ parseNameAndArgTypes(const char *string, bool allow= None, List **names, Assert(*ptr =3D=3D '\0'); } /* Lop off trailing whitespace */ - while (--ptr2 >=3D typename) + while (--ptr2 >=3D typname) { if (!isspace((unsigned char) *ptr2)) break; *ptr2 =3D '\0'; } =20 - if (allowNone && pg_strcasecmp(typename, "none") =3D=3D 0) + if (allowNone && pg_strcasecmp(typname, "none") =3D=3D 0) { /* Special case for NONE */ - typeid =3D InvalidOid; + typid =3D InvalidOid; typmod =3D -1; } else { /* Use full parser to resolve the type name */ - parseTypeString(typename, &typeid, &typmod, false); + parseTypeString(typname, &typid, &typmod, false); } if (*nargs >=3D FUNC_MAX_ARGS) ereport(ERROR, (errcode(ERRCODE_TOO_MANY_ARGUMENTS), errmsg("too many arguments"))); =20 - argtypes[*nargs] =3D typeid; + argtypes[*nargs] =3D typid; (*nargs)++; } =20 diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri= _triggers.c index 37139f9647..a48054d5ad 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -164,7 +164,7 @@ typedef struct RI_QueryHashEntry typedef struct RI_CompareKey { Oid eq_opr; /* the equality operator to apply */ - Oid typeid; /* the data type to apply it to */ + Oid typid; /* the data type to apply it to */ } RI_CompareKey; =20 =20 @@ -217,14 +217,14 @@ static void ri_BuildQueryKey(RI_QueryKey *key, int32 constr_queryno); static bool ri_KeysEqual(Relation rel, HeapTuple oldtup, HeapTuple newtup, const RI_ConstraintInfo *riinfo, bool rel_is_pk); -static bool ri_AttributesEqual(Oid eq_opr, Oid typeid, +static bool ri_AttributesEqual(Oid eq_opr, Oid typid, Datum oldvalue, Datum newvalue); =20 static void ri_InitHashTables(void); static void InvalidateConstraintCacheCallBack(Datum arg, int cacheid, uint= 32 hashvalue); static SPIPlanPtr ri_FetchPreparedPlan(RI_QueryKey *key); static void ri_HashPreparedPlan(RI_QueryKey *key, SPIPlanPtr plan); -static RI_CompareHashEntry *ri_HashCompareOp(Oid eq_opr, Oid typeid); +static RI_CompareHashEntry *ri_HashCompareOp(Oid eq_opr, Oid typid); =20 static void ri_CheckTrigger(FunctionCallInfo fcinfo, const char *funcname, int tgkind); @@ -3574,10 +3574,10 @@ ri_KeysEqual(Relation rel, HeapTuple oldtup, HeapTu= ple newtup, * ---------- */ static bool -ri_AttributesEqual(Oid eq_opr, Oid typeid, +ri_AttributesEqual(Oid eq_opr, Oid typid, Datum oldvalue, Datum newvalue) { - RI_CompareHashEntry *entry =3D ri_HashCompareOp(eq_opr, typeid); + RI_CompareHashEntry *entry =3D ri_HashCompareOp(eq_opr, typid); =20 /* Do we need to cast the values? */ if (OidIsValid(entry->cast_func_finfo.fn_oid)) @@ -3608,7 +3608,7 @@ ri_AttributesEqual(Oid eq_opr, Oid typeid, * ---------- */ static RI_CompareHashEntry * -ri_HashCompareOp(Oid eq_opr, Oid typeid) +ri_HashCompareOp(Oid eq_opr, Oid typid) { RI_CompareKey key; RI_CompareHashEntry *entry; @@ -3625,7 +3625,7 @@ ri_HashCompareOp(Oid eq_opr, Oid typeid) * contains no struct padding. */ key.eq_opr =3D eq_opr; - key.typeid =3D typeid; + key.typid =3D typid; entry =3D (RI_CompareHashEntry *) hash_search(ri_compare_cache, (void *) &key, HASH_ENTER, &found); @@ -3662,11 +3662,11 @@ ri_HashCompareOp(Oid eq_opr, Oid typeid) */ op_input_types(eq_opr, &lefttype, &righttype); Assert(lefttype =3D=3D righttype); - if (typeid =3D=3D lefttype) + if (typid =3D=3D lefttype) castfunc =3D InvalidOid; /* simplest case */ else { - pathtype =3D find_coercion_pathway(lefttype, typeid, + pathtype =3D find_coercion_pathway(lefttype, typid, COERCION_IMPLICIT, &castfunc); if (pathtype !=3D COERCION_PATH_FUNC && @@ -3678,9 +3678,9 @@ ri_HashCompareOp(Oid eq_opr, Oid typeid) * special cases such as RECORD; find_coercion_pathway * currently doesn't subsume these special cases. */ - if (!IsBinaryCoercible(typeid, lefttype)) + if (!IsBinaryCoercible(typid, lefttype)) elog(ERROR, "no conversion function from %s to %s", - format_type_be(typeid), + format_type_be(typid), format_type_be(lefttype)); } } diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/rule= utils.c index b27b77de21..b71899fe0f 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -396,9 +396,9 @@ static void get_rule_windowspec(WindowClause *wc, List = *targetList, static char *get_variable(Var *var, int levelsup, bool istoplevel, deparse_context *context); static void get_special_variable(Node *node, deparse_context *context, - void *private); + void *private_data); static void resolve_special_varno(Node *node, deparse_context *context, - void *private, + void *private_data, void (*callback) (Node *, deparse_context *, void *)); static Node *find_param_referent(Param *param, deparse_context *context, deparse_namespace **dpns_p, ListCell **ancestor_cell_p); @@ -418,7 +418,7 @@ static void get_func_expr(FuncExpr *expr, deparse_conte= xt *context, static void get_agg_expr(Aggref *aggref, deparse_context *context, Aggref *original_aggref); static void get_agg_combine_expr(Node *node, deparse_context *context, - void *private); + void *private_data); static void get_windowfunc_expr(WindowFunc *wfunc, deparse_context *contex= t); static void get_coercion_expr(Node *arg, deparse_context *context, Oid resulttype, int32 resulttypmod, @@ -6349,7 +6349,7 @@ get_variable(Var *var, int levelsup, bool istoplevel,= deparse_context *context) * get_rule_expr. */ static void -get_special_variable(Node *node, deparse_context *context, void *private) +get_special_variable(Node *node, deparse_context *context, void *private_d= ata) { StringInfo buf =3D context->buf; =20 @@ -6370,7 +6370,7 @@ get_special_variable(Node *node, deparse_context *con= text, void *private) * invoke the callback provided. */ static void -resolve_special_varno(Node *node, deparse_context *context, void *private, +resolve_special_varno(Node *node, deparse_context *context, void *private_= data, void (*callback) (Node *, deparse_context *, void *)) { Var *var; @@ -6379,7 +6379,7 @@ resolve_special_varno(Node *node, deparse_context *co= ntext, void *private, /* If it's not a Var, invoke the callback. */ if (!IsA(node, Var)) { - callback(node, context, private); + callback(node, context, private_data); return; } =20 @@ -6401,7 +6401,7 @@ resolve_special_varno(Node *node, deparse_context *co= ntext, void *private, elog(ERROR, "bogus varattno for OUTER_VAR var: %d", var->varattno); =20 push_child_plan(dpns, dpns->outer_planstate, &save_dpns); - resolve_special_varno((Node *) tle->expr, context, private, callback); + resolve_special_varno((Node *) tle->expr, context, private_data, callbac= k); pop_child_plan(dpns, &save_dpns); return; } @@ -6415,7 +6415,7 @@ resolve_special_varno(Node *node, deparse_context *co= ntext, void *private, elog(ERROR, "bogus varattno for INNER_VAR var: %d", var->varattno); =20 push_child_plan(dpns, dpns->inner_planstate, &save_dpns); - resolve_special_varno((Node *) tle->expr, context, private, callback); + resolve_special_varno((Node *) tle->expr, context, private_data, callbac= k); pop_child_plan(dpns, &save_dpns); return; } @@ -6427,14 +6427,14 @@ resolve_special_varno(Node *node, deparse_context *= context, void *private, if (!tle) elog(ERROR, "bogus varattno for INDEX_VAR var: %d", var->varattno); =20 - resolve_special_varno((Node *) tle->expr, context, private, callback); + resolve_special_varno((Node *) tle->expr, context, private_data, callbac= k); return; } else if (var->varno < 1 || var->varno > list_length(dpns->rtable)) elog(ERROR, "bogus varno: %d", var->varno); =20 /* Not special. Just invoke the callback. */ - callback(node, context, private); + callback(node, context, private_data); } =20 /* @@ -8827,10 +8827,10 @@ get_agg_expr(Aggref *aggref, deparse_context *conte= xt, * Aggref and then calls this. */ static void -get_agg_combine_expr(Node *node, deparse_context *context, void *private) +get_agg_combine_expr(Node *node, deparse_context *context, void *private_d= ata) { Aggref *aggref; - Aggref *original_aggref =3D private; + Aggref *original_aggref =3D private_data; =20 if (!IsA(node, Aggref)) elog(ERROR, "combining Aggref does not point to an Aggref"); diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfu= ncs.c index 8b05e8f9f7..ba29af1993 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -39,13 +39,13 @@ * The call convention for a restriction estimator (oprrest function) is * * Selectivity oprrest (PlannerInfo *root, - * Oid operator, + * Oid opid, * List *args, * int varRelid); * * root: general information about the query (rtable and RelOptInfo lists * are particularly important for the estimator). - * operator: OID of the specific operator in question. + * opid: OID of the specific operator in question. * args: argument list from the operator clause. * varRelid: if not zero, the relid (rtable index) of the relation to * be treated as the variable relation. May be zero if the args list @@ -64,7 +64,7 @@ * supplied: * * Selectivity oprjoin (PlannerInfo *root, - * Oid operator, + * Oid opid, * List *args, * JoinType jointype, * SpecialJoinInfo *sjinfo); @@ -148,19 +148,19 @@ get_relation_stats_hook_type get_relation_stats_hook =3D NULL; get_index_stats_hook_type get_index_stats_hook =3D NULL; =20 -static double var_eq_const(VariableStatData *vardata, Oid operator, +static double var_eq_const(VariableStatData *vardata, Oid opid, Datum constval, bool constisnull, bool varonleft); -static double var_eq_non_const(VariableStatData *vardata, Oid operator, +static double var_eq_non_const(VariableStatData *vardata, Oid opid, Node *other, bool varonleft); static double ineq_histogram_selectivity(PlannerInfo *root, VariableStatData *vardata, FmgrInfo *opproc, bool isgt, Datum constval, Oid consttype); -static double eqjoinsel_inner(Oid operator, +static double eqjoinsel_inner(Oid opid, VariableStatData *vardata1, VariableStatData *vardata2); -static double eqjoinsel_semi(Oid operator, +static double eqjoinsel_semi(Oid opid, VariableStatData *vardata1, VariableStatData *vardata2, RelOptInfo *inner_rel); static bool convert_to_scalar(Datum value, Oid valuetypid, double *scaledv= alue, @@ -220,7 +220,7 @@ Datum eqsel(PG_FUNCTION_ARGS) { PlannerInfo *root =3D (PlannerInfo *) PG_GETARG_POINTER(0); - Oid operator =3D PG_GETARG_OID(1); + Oid opid =3D PG_GETARG_OID(1); List *args =3D (List *) PG_GETARG_POINTER(2); int varRelid =3D PG_GETARG_INT32(3); VariableStatData vardata; @@ -242,12 +242,12 @@ eqsel(PG_FUNCTION_ARGS) * in the query.) */ if (IsA(other, Const)) - selec =3D var_eq_const(&vardata, operator, + selec =3D var_eq_const(&vardata, opid, ((Const *) other)->constvalue, ((Const *) other)->constisnull, varonleft); else - selec =3D var_eq_non_const(&vardata, operator, other, + selec =3D var_eq_non_const(&vardata, opid, other, varonleft); =20 ReleaseVariableStats(vardata); @@ -261,7 +261,7 @@ eqsel(PG_FUNCTION_ARGS) * This is split out so that some other estimation functions can use it. */ static double -var_eq_const(VariableStatData *vardata, Oid operator, +var_eq_const(VariableStatData *vardata, Oid opid, Datum constval, bool constisnull, bool varonleft) { @@ -313,7 +313,7 @@ var_eq_const(VariableStatData *vardata, Oid operator, { FmgrInfo eqproc; =20 - fmgr_info(get_opcode(operator), &eqproc); + fmgr_info(get_opcode(opid), &eqproc); =20 for (i =3D 0; i < nvalues; i++) { @@ -403,7 +403,7 @@ var_eq_const(VariableStatData *vardata, Oid operator, * var_eq_non_const --- eqsel for var =3D something-other-than-const case */ static double -var_eq_non_const(VariableStatData *vardata, Oid operator, +var_eq_non_const(VariableStatData *vardata, Oid opid, Node *other, bool varonleft) { @@ -487,7 +487,7 @@ Datum neqsel(PG_FUNCTION_ARGS) { PlannerInfo *root =3D (PlannerInfo *) PG_GETARG_POINTER(0); - Oid operator =3D PG_GETARG_OID(1); + Oid opid =3D PG_GETARG_OID(1); List *args =3D (List *) PG_GETARG_POINTER(2); int varRelid =3D PG_GETARG_INT32(3); Oid eqop; @@ -497,7 +497,7 @@ neqsel(PG_FUNCTION_ARGS) * We want 1 - eqsel() where the equality operator is the one associated * with this !=3D operator, that is, its negator. */ - eqop =3D get_negator(operator); + eqop =3D get_negator(opid); if (eqop) { result =3D DatumGetFloat8(DirectFunctionCall4(eqsel, @@ -529,7 +529,7 @@ neqsel(PG_FUNCTION_ARGS) * it will return a default estimate. */ static double -scalarineqsel(PlannerInfo *root, Oid operator, bool isgt, +scalarineqsel(PlannerInfo *root, Oid opid, bool isgt, VariableStatData *vardata, Datum constval, Oid consttype) { Form_pg_statistic stats; @@ -546,7 +546,7 @@ scalarineqsel(PlannerInfo *root, Oid operator, bool isg= t, } stats =3D (Form_pg_statistic) GETSTRUCT(vardata->statsTuple); =20 - fmgr_info(get_opcode(operator), &opproc); + fmgr_info(get_opcode(opid), &opproc); =20 /* * If we have most-common-values info, add up the fractions of the MCV @@ -963,7 +963,7 @@ Datum scalarltsel(PG_FUNCTION_ARGS) { PlannerInfo *root =3D (PlannerInfo *) PG_GETARG_POINTER(0); - Oid operator =3D PG_GETARG_OID(1); + Oid opid =3D PG_GETARG_OID(1); List *args =3D (List *) PG_GETARG_POINTER(2); int varRelid =3D PG_GETARG_INT32(3); VariableStatData vardata; @@ -1014,8 +1014,8 @@ scalarltsel(PG_FUNCTION_ARGS) else { /* we have other < var, commute to make var > other */ - operator =3D get_commutator(operator); - if (!operator) + opid =3D get_commutator(opid); + if (!opid) { /* Use default selectivity (should we raise an error instead?) */ ReleaseVariableStats(vardata); @@ -1024,7 +1024,7 @@ scalarltsel(PG_FUNCTION_ARGS) isgt =3D true; } =20 - selec =3D scalarineqsel(root, operator, isgt, &vardata, constval, constty= pe); + selec =3D scalarineqsel(root, opid, isgt, &vardata, constval, consttype); =20 ReleaseVariableStats(vardata); =20 @@ -1038,7 +1038,7 @@ Datum scalargtsel(PG_FUNCTION_ARGS) { PlannerInfo *root =3D (PlannerInfo *) PG_GETARG_POINTER(0); - Oid operator =3D PG_GETARG_OID(1); + Oid opid =3D PG_GETARG_OID(1); List *args =3D (List *) PG_GETARG_POINTER(2); int varRelid =3D PG_GETARG_INT32(3); VariableStatData vardata; @@ -1089,8 +1089,8 @@ scalargtsel(PG_FUNCTION_ARGS) else { /* we have other > var, commute to make var < other */ - operator =3D get_commutator(operator); - if (!operator) + opid =3D get_commutator(opid); + if (!opid) { /* Use default selectivity (should we raise an error instead?) */ ReleaseVariableStats(vardata); @@ -1099,7 +1099,7 @@ scalargtsel(PG_FUNCTION_ARGS) isgt =3D false; } =20 - selec =3D scalarineqsel(root, operator, isgt, &vardata, constval, constty= pe); + selec =3D scalarineqsel(root, opid, isgt, &vardata, constval, consttype); =20 ReleaseVariableStats(vardata); =20 @@ -1113,7 +1113,7 @@ static double patternsel(PG_FUNCTION_ARGS, Pattern_Type ptype, bool negate) { PlannerInfo *root =3D (PlannerInfo *) PG_GETARG_POINTER(0); - Oid operator =3D PG_GETARG_OID(1); + Oid opid =3D PG_GETARG_OID(1); List *args =3D (List *) PG_GETARG_POINTER(2); int varRelid =3D PG_GETARG_INT32(3); Oid collation =3D PG_GET_COLLATION(); @@ -1137,8 +1137,8 @@ patternsel(PG_FUNCTION_ARGS, Pattern_Type ptype, bool= negate) */ if (negate) { - operator =3D get_negator(operator); - if (!OidIsValid(operator)) + opid =3D get_negator(opid); + if (!OidIsValid(opid)) elog(ERROR, "patternsel called for operator without a negator"); result =3D 1.0 - DEFAULT_MATCH_SEL; } @@ -1294,7 +1294,7 @@ patternsel(PG_FUNCTION_ARGS, Pattern_Type ptype, bool= negate) sumcommon; =20 /* Try to use the histogram entries to get selectivity */ - fmgr_info(get_opcode(operator), &opproc); + fmgr_info(get_opcode(opid), &opproc); =20 selec =3D histogram_selectivity(&vardata, &opproc, constval, true, 10, 1, &hist_size); @@ -1763,7 +1763,7 @@ scalararraysel(PlannerInfo *root, JoinType jointype, SpecialJoinInfo *sjinfo) { - Oid operator =3D clause->opno; + Oid opid =3D clause->opno; bool useOr =3D clause->useOr; bool isEquality =3D false; bool isInequality =3D false; @@ -1803,9 +1803,9 @@ scalararraysel(PlannerInfo *root, typentry =3D lookup_type_cache(nominal_element_type, TYPECACHE_EQ_OPR); if (OidIsValid(typentry->eq_opr)) { - if (operator =3D=3D typentry->eq_opr) + if (opid =3D=3D typentry->eq_opr) isEquality =3D true; - else if (get_negator(operator) =3D=3D typentry->eq_opr) + else if (get_negator(opid) =3D=3D typentry->eq_opr) isInequality =3D true; } =20 @@ -1829,9 +1829,9 @@ scalararraysel(PlannerInfo *root, * hasn't got one. */ if (is_join_clause) - oprsel =3D get_oprjoin(operator); + oprsel =3D get_oprjoin(opid); else - oprsel =3D get_oprrest(operator); + oprsel =3D get_oprrest(opid); if (!oprsel) return (Selectivity) 0.5; fmgr_info(oprsel, &oprselproc); @@ -1917,7 +1917,7 @@ scalararraysel(PlannerInfo *root, s2 =3D DatumGetFloat8(FunctionCall5Coll(&oprselproc, clause->inputcollid, PointerGetDatum(root), - ObjectIdGetDatum(operator), + ObjectIdGetDatum(opid), PointerGetDatum(args), Int16GetDatum(jointype), PointerGetDatum(sjinfo))); @@ -1925,7 +1925,7 @@ scalararraysel(PlannerInfo *root, s2 =3D DatumGetFloat8(FunctionCall4Coll(&oprselproc, clause->inputcollid, PointerGetDatum(root), - ObjectIdGetDatum(operator), + ObjectIdGetDatum(opid), PointerGetDatum(args), Int32GetDatum(varRelid))); =20 @@ -1984,7 +1984,7 @@ scalararraysel(PlannerInfo *root, s2 =3D DatumGetFloat8(FunctionCall5Coll(&oprselproc, clause->inputcollid, PointerGetDatum(root), - ObjectIdGetDatum(operator), + ObjectIdGetDatum(opid), PointerGetDatum(args), Int16GetDatum(jointype), PointerGetDatum(sjinfo))); @@ -1992,7 +1992,7 @@ scalararraysel(PlannerInfo *root, s2 =3D DatumGetFloat8(FunctionCall4Coll(&oprselproc, clause->inputcollid, PointerGetDatum(root), - ObjectIdGetDatum(operator), + ObjectIdGetDatum(opid), PointerGetDatum(args), Int32GetDatum(varRelid))); =20 @@ -2036,7 +2036,7 @@ scalararraysel(PlannerInfo *root, s2 =3D DatumGetFloat8(FunctionCall5Coll(&oprselproc, clause->inputcollid, PointerGetDatum(root), - ObjectIdGetDatum(operator), + ObjectIdGetDatum(opid), PointerGetDatum(args), Int16GetDatum(jointype), PointerGetDatum(sjinfo))); @@ -2044,7 +2044,7 @@ scalararraysel(PlannerInfo *root, s2 =3D DatumGetFloat8(FunctionCall4Coll(&oprselproc, clause->inputcollid, PointerGetDatum(root), - ObjectIdGetDatum(operator), + ObjectIdGetDatum(opid), PointerGetDatum(args), Int32GetDatum(varRelid))); s1 =3D useOr ? 0.0 : 1.0; @@ -2183,7 +2183,7 @@ Datum eqjoinsel(PG_FUNCTION_ARGS) { PlannerInfo *root =3D (PlannerInfo *) PG_GETARG_POINTER(0); - Oid operator =3D PG_GETARG_OID(1); + Oid opid =3D PG_GETARG_OID(1); List *args =3D (List *) PG_GETARG_POINTER(2); =20 #ifdef NOT_USED @@ -2204,7 +2204,7 @@ eqjoinsel(PG_FUNCTION_ARGS) case JOIN_INNER: case JOIN_LEFT: case JOIN_FULL: - selec =3D eqjoinsel_inner(operator, &vardata1, &vardata2); + selec =3D eqjoinsel_inner(opid, &vardata1, &vardata2); break; case JOIN_SEMI: case JOIN_ANTI: @@ -2218,10 +2218,10 @@ eqjoinsel(PG_FUNCTION_ARGS) inner_rel =3D find_join_input_rel(root, sjinfo->min_righthand); =20 if (!join_is_reversed) - selec =3D eqjoinsel_semi(operator, &vardata1, &vardata2, + selec =3D eqjoinsel_semi(opid, &vardata1, &vardata2, inner_rel); else - selec =3D eqjoinsel_semi(get_commutator(operator), + selec =3D eqjoinsel_semi(get_commutator(opid), &vardata2, &vardata1, inner_rel); break; @@ -2248,7 +2248,7 @@ eqjoinsel(PG_FUNCTION_ARGS) * that it's worth trying to distinguish them here. */ static double -eqjoinsel_inner(Oid operator, +eqjoinsel_inner(Oid opid, VariableStatData *vardata1, VariableStatData *vardata2) { double selec; @@ -2329,7 +2329,7 @@ eqjoinsel_inner(Oid operator, int i, nmatches; =20 - fmgr_info(get_opcode(operator), &eqproc); + fmgr_info(get_opcode(opid), &eqproc); hasmatch1 =3D (bool *) palloc0(nvalues1 * sizeof(bool)); hasmatch2 =3D (bool *) palloc0(nvalues2 * sizeof(bool)); =20 @@ -2474,7 +2474,7 @@ eqjoinsel_inner(Oid operator, * Caller has ensured that vardata1 is the LHS variable. */ static double -eqjoinsel_semi(Oid operator, +eqjoinsel_semi(Oid opid, VariableStatData *vardata1, VariableStatData *vardata2, RelOptInfo *inner_rel) { @@ -2556,7 +2556,7 @@ eqjoinsel_semi(Oid operator, &numbers2, &nnumbers2); } =20 - if (have_mcvs1 && have_mcvs2 && OidIsValid(operator)) + if (have_mcvs1 && have_mcvs2 && OidIsValid(opid)) { /* * We have most-common-value lists for both relations. Run through @@ -2586,7 +2586,7 @@ eqjoinsel_semi(Oid operator, */ clamped_nvalues2 =3D Min(nvalues2, nd2); =20 - fmgr_info(get_opcode(operator), &eqproc); + fmgr_info(get_opcode(opid), &eqproc); hasmatch1 =3D (bool *) palloc0(nvalues1 * sizeof(bool)); hasmatch2 =3D (bool *) palloc0(clamped_nvalues2 * sizeof(bool)); =20 @@ -2693,7 +2693,7 @@ Datum neqjoinsel(PG_FUNCTION_ARGS) { PlannerInfo *root =3D (PlannerInfo *) PG_GETARG_POINTER(0); - Oid operator =3D PG_GETARG_OID(1); + Oid opid =3D PG_GETARG_OID(1); List *args =3D (List *) PG_GETARG_POINTER(2); JoinType jointype =3D (JoinType) PG_GETARG_INT16(3); SpecialJoinInfo *sjinfo =3D (SpecialJoinInfo *) PG_GETARG_POINTER(4); @@ -2704,7 +2704,7 @@ neqjoinsel(PG_FUNCTION_ARGS) * We want 1 - eqjoinsel() where the equality operator is the one * associated with this !=3D operator, that is, its negator. */ - eqop =3D get_negator(operator); + eqop =3D get_negator(opid); if (eqop) { result =3D DatumGetFloat8(DirectFunctionCall5(eqjoinsel, @@ -5297,7 +5297,7 @@ like_fixed_prefix(Const *patt_const, bool case_insens= itive, Oid collation, char *match; char *patt; int pattlen; - Oid typeid =3D patt_const->consttype; + Oid typid =3D patt_const->consttype; int pos, match_pos; bool is_multibyte =3D (pg_database_encoding_max_length() > 1); @@ -5305,11 +5305,11 @@ like_fixed_prefix(Const *patt_const, bool case_inse= nsitive, Oid collation, bool locale_is_c =3D false; =20 /* the right-hand const is type text or bytea */ - Assert(typeid =3D=3D BYTEAOID || typeid =3D=3D TEXTOID); + Assert(typid =3D=3D BYTEAOID || typid =3D=3D TEXTOID); =20 if (case_insensitive) { - if (typeid =3D=3D BYTEAOID) + if (typid =3D=3D BYTEAOID) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("case insensitive matching not supported on type bytea"))); @@ -5334,7 +5334,7 @@ like_fixed_prefix(Const *patt_const, bool case_insens= itive, Oid collation, } } =20 - if (typeid !=3D BYTEAOID) + if (typid !=3D BYTEAOID) { patt =3D TextDatumGetCString(patt_const->constvalue); pattlen =3D strlen(patt); @@ -5377,8 +5377,8 @@ like_fixed_prefix(Const *patt_const, bool case_insens= itive, Oid collation, =20 match[match_pos] =3D '\0'; =20 - if (typeid !=3D BYTEAOID) - *prefix_const =3D string_to_const(match, typeid); + if (typid !=3D BYTEAOID) + *prefix_const =3D string_to_const(match, typid); else *prefix_const =3D string_to_bytea_const(match, match_pos); =20 @@ -5403,7 +5403,7 @@ static Pattern_Prefix_Status regex_fixed_prefix(Const *patt_const, bool case_insensitive, Oid collation, Const **prefix_const, Selectivity *rest_selec) { - Oid typeid =3D patt_const->consttype; + Oid typid =3D patt_const->consttype; char *prefix; bool exact; =20 @@ -5412,7 +5412,7 @@ regex_fixed_prefix(Const *patt_const, bool case_insen= sitive, Oid collation, * such, it should be noted that the rest of this function has *not* been * made safe for binary (possibly NULL containing) strings. */ - if (typeid =3D=3D BYTEAOID) + if (typid =3D=3D BYTEAOID) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("regular-expression matching not supported on type bytea"))); @@ -5439,7 +5439,7 @@ regex_fixed_prefix(Const *patt_const, bool case_insen= sitive, Oid collation, return Pattern_Prefix_None; } =20 - *prefix_const =3D string_to_const(prefix, typeid); + *prefix_const =3D string_to_const(prefix, typid); =20 if (rest_selec !=3D NULL) { diff --git a/src/backend/utils/adt/tsquery.c b/src/backend/utils/adt/tsquer= y.c index 3e2fc6e9df..e2f7eebf13 100644 --- a/src/backend/utils/adt/tsquery.c +++ b/src/backend/utils/adt/tsquery.c @@ -220,7 +220,7 @@ typedef enum */ static ts_tokentype gettoken_query(TSQueryParserState state, - int8 *operator, + int8 *oper, int *lenval, char **strval, int16 *weight, bool *prefix) { *weight =3D 0; @@ -236,7 +236,7 @@ gettoken_query(TSQueryParserState state, { (state->buf)++; /* can safely ++, t_iseq guarantee * that pg_mblen()=3D=3D1 */ - *operator =3D OP_NOT; + *oper =3D OP_NOT; state->state =3D WAITOPERAND; return PT_OPR; } @@ -280,21 +280,21 @@ gettoken_query(TSQueryParserState state, if (t_iseq(state->buf, '&')) { state->state =3D WAITOPERAND; - *operator =3D OP_AND; + *oper =3D OP_AND; (state->buf)++; return PT_OPR; } else if (t_iseq(state->buf, '|')) { state->state =3D WAITOPERAND; - *operator =3D OP_OR; + *oper =3D OP_OR; (state->buf)++; return PT_OPR; } else if (t_iseq(state->buf, '<')) { state->state =3D WAITOPERAND; - *operator =3D OP_PHRASE; + *oper =3D OP_PHRASE; /* weight var is used as storage for distance */ state->buf =3D parse_phrase_operator(state->buf, weight); if (*weight < 0) @@ -477,7 +477,7 @@ makepol(TSQueryParserState state, PushFunction pushval, Datum opaque) { - int8 operator =3D 0; + int8 oper =3D 0; ts_tokentype type; int lenval =3D 0; char *strval =3D NULL; @@ -489,7 +489,7 @@ makepol(TSQueryParserState state, /* since this function recurses, it could be driven to stack overflow */ check_stack_depth(); =20 - while ((type =3D gettoken_query(state, &operator, &lenval, &strval, &weig= ht, &prefix)) !=3D PT_END) + while ((type =3D gettoken_query(state, &oper, &lenval, &strval, &weight, = &prefix)) !=3D PT_END) { switch (type) { @@ -497,8 +497,8 @@ makepol(TSQueryParserState state, pushval(opaque, state, strval, lenval, weight, prefix); break; case PT_OPR: - cleanOpStack(state, opstack, &lenstack, operator); - pushOpStack(opstack, &lenstack, operator, weight); + cleanOpStack(state, opstack, &lenstack, oper); + pushOpStack(opstack, &lenstack, oper, weight); break; case PT_OPEN: makepol(state, pushval, opaque); diff --git a/src/backend/utils/adt/tsquery_op.c b/src/backend/utils/adt/tsq= uery_op.c index 755c3e9ee8..3d4b13378b 100644 --- a/src/backend/utils/adt/tsquery_op.c +++ b/src/backend/utils/adt/tsquery_op.c @@ -28,7 +28,7 @@ tsquery_numnode(PG_FUNCTION_ARGS) } =20 static QTNode * -join_tsqueries(TSQuery a, TSQuery b, int8 operator, uint16 distance) +join_tsqueries(TSQuery a, TSQuery b, int8 oper, uint16 distance) { QTNode *res =3D (QTNode *) palloc0(sizeof(QTNode)); =20 @@ -36,8 +36,8 @@ join_tsqueries(TSQuery a, TSQuery b, int8 operator, uint1= 6 distance) =20 res->valnode =3D (QueryItem *) palloc0(sizeof(QueryItem)); res->valnode->type =3D QI_OPR; - res->valnode->qoperator.oper =3D operator; - if (operator =3D=3D OP_PHRASE) + res->valnode->qoperator.oper =3D oper; + if (oper =3D=3D OP_PHRASE) res->valnode->qoperator.distance =3D distance; =20 res->child =3D (QTNode **) palloc0(sizeof(QTNode *) * 2); diff --git a/src/backend/utils/adt/varbit.c b/src/backend/utils/adt/varbit.c index e947785d81..b87d379469 100644 --- a/src/backend/utils/adt/varbit.c +++ b/src/backend/utils/adt/varbit.c @@ -35,7 +35,7 @@ static VarBit *bit_overlay(VarBit *t1, VarBit *t2, int sp= , int sl); * common code for bittypmodin and varbittypmodin */ static int32 -anybit_typmodin(ArrayType *ta, const char *typename) +anybit_typmodin(ArrayType *ta, const char *typname) { int32 typmod; int32 *tl; @@ -56,12 +56,12 @@ anybit_typmodin(ArrayType *ta, const char *typename) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("length for type %s must be at least 1", - typename))); + typname))); if (*tl > (MaxAttrSize * BITS_PER_BYTE)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("length for type %s cannot exceed %d", - typename, MaxAttrSize * BITS_PER_BYTE))); + typname, MaxAttrSize * BITS_PER_BYTE))); =20 typmod =3D *tl; =20 diff --git a/src/backend/utils/adt/varchar.c b/src/backend/utils/adt/varcha= r.c index 6f2f9f6633..2d9ea12a37 100644 --- a/src/backend/utils/adt/varchar.c +++ b/src/backend/utils/adt/varchar.c @@ -28,7 +28,7 @@ =20 /* common code for bpchartypmodin and varchartypmodin */ static int32 -anychar_typmodin(ArrayType *ta, const char *typename) +anychar_typmodin(ArrayType *ta, const char *typname) { int32 typmod; int32 *tl; @@ -48,12 +48,12 @@ anychar_typmodin(ArrayType *ta, const char *typename) if (*tl < 1) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("length for type %s must be at least 1", typename))); + errmsg("length for type %s must be at least 1", typname))); if (*tl > MaxAttrSize) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("length for type %s cannot exceed %d", - typename, MaxAttrSize))); + typname, MaxAttrSize))); =20 /* * For largely historical reasons, the typmod is VARHDRSZ plus the number diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c index e8bce3b806..c060556002 100644 --- a/src/backend/utils/adt/xml.c +++ b/src/backend/utils/adt/xml.c @@ -3352,7 +3352,7 @@ static const char * map_sql_type_to_xmlschema_type(Oid typeoid, int typmod) { StringInfoData result; - const char *typename =3D map_sql_type_to_xml_name(typeoid, typmod); + const char *typname =3D map_sql_type_to_xml_name(typeoid, typmod); =20 initStringInfo(&result); =20 @@ -3368,7 +3368,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmo= d) else { appendStringInfo(&result, - "\n", typename); + "\n", typname); =20 switch (typeoid) { diff --git a/src/backend/utils/cache/ts_cache.c b/src/backend/utils/cache/t= s_cache.c index 88e4ffb66d..1cc47e42ed 100644 --- a/src/backend/utils/cache/ts_cache.c +++ b/src/backend/utils/cache/ts_cache.c @@ -250,7 +250,7 @@ lookup_ts_dictionary_cache(Oid dictId) HeapTuple tpdict, tptmpl; Form_pg_ts_dict dict; - Form_pg_ts_template template; + Form_pg_ts_template tmpl; MemoryContext saveCtx; =20 tpdict =3D SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId)); @@ -273,14 +273,14 @@ lookup_ts_dictionary_cache(Oid dictId) if (!HeapTupleIsValid(tptmpl)) elog(ERROR, "cache lookup failed for text search template %u", dict->dicttemplate); - template =3D (Form_pg_ts_template) GETSTRUCT(tptmpl); + tmpl =3D (Form_pg_ts_template) GETSTRUCT(tptmpl); =20 /* * Sanity checks */ - if (!OidIsValid(template->tmpllexize)) + if (!OidIsValid(tmpl->tmpllexize)) elog(ERROR, "text search template %u has no lexize method", - template->tmpllexize); + tmpl->tmpllexize); =20 if (entry =3D=3D NULL) { @@ -309,9 +309,9 @@ lookup_ts_dictionary_cache(Oid dictId) entry->dictId =3D dictId; entry->dictCtx =3D saveCtx; =20 - entry->lexizeOid =3D template->tmpllexize; + entry->lexizeOid =3D tmpl->tmpllexize; =20 - if (OidIsValid(template->tmplinit)) + if (OidIsValid(tmpl->tmplinit)) { List *dictoptions; Datum opt; @@ -333,7 +333,7 @@ lookup_ts_dictionary_cache(Oid dictId) dictoptions =3D deserialize_deflist(opt); =20 entry->dictData =3D - DatumGetPointer(OidFunctionCall1(template->tmplinit, + DatumGetPointer(OidFunctionCall1(tmpl->tmplinit, PointerGetDatum(dictoptions))); =20 MemoryContextSwitchTo(oldcontext); diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c index 94d7dac94c..7a754cde2e 100644 --- a/src/backend/utils/fmgr/dfmgr.c +++ b/src/backend/utils/fmgr/dfmgr.c @@ -482,8 +482,8 @@ static char * expand_dynamic_library_name(const char *name) { bool have_slash; - char *new; - char *full; + char *newname; + char *fullname; =20 AssertArg(name); =20 @@ -491,34 +491,34 @@ expand_dynamic_library_name(const char *name) =20 if (!have_slash) { - full =3D find_in_dynamic_libpath(name); - if (full) - return full; + fullname =3D find_in_dynamic_libpath(name); + if (fullname) + return fullname; } else { - full =3D substitute_libpath_macro(name); - if (file_exists(full)) - return full; - pfree(full); + fullname =3D substitute_libpath_macro(name); + if (file_exists(fullname)) + return fullname; + pfree(fullname); } =20 - new =3D psprintf("%s%s", name, DLSUFFIX); + newname =3D psprintf("%s%s", name, DLSUFFIX); =20 if (!have_slash) { - full =3D find_in_dynamic_libpath(new); - pfree(new); - if (full) - return full; + fullname =3D find_in_dynamic_libpath(newname); + pfree(newname); + if (fullname) + return fullname; } else { - full =3D substitute_libpath_macro(new); - pfree(new); - if (file_exists(full)) - return full; - pfree(full); + fullname =3D substitute_libpath_macro(newname); + pfree(newname); + if (file_exists(fullname)) + return fullname; + pfree(fullname); } =20 /* diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/mis= cinit.c index e0298ee35f..f9a1a7cc52 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -92,16 +92,16 @@ SetDatabasePath(const char *path) void SetDataDir(const char *dir) { - char *new; + char *newdir; =20 AssertArg(dir); =20 /* If presented path is relative, convert to absolute */ - new =3D make_absolute_path(dir); + newdir =3D make_absolute_path(dir); =20 if (DataDir) free(DataDir); - DataDir =3D new; + DataDir =3D newdir; } =20 /* diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c index 89530a9f0f..f6fb908347 100644 --- a/src/bin/pg_dump/common.c +++ b/src/bin/pg_dump/common.c @@ -469,7 +469,7 @@ flagInhAttrs(DumpOptions *dopt, TableInfo *tblinfo, int= numTables) attrDef->dobj.catId.oid =3D 0; AssignDumpId(&attrDef->dobj); attrDef->dobj.name =3D pg_strdup(tbinfo->dobj.name); - attrDef->dobj.namespace =3D tbinfo->dobj.namespace; + attrDef->dobj.namespaceinfo =3D tbinfo->dobj.namespaceinfo; attrDef->dobj.dump =3D tbinfo->dobj.dump; =20 attrDef->adtable =3D tbinfo; @@ -510,7 +510,7 @@ AssignDumpId(DumpableObject *dobj) { dobj->dumpId =3D ++lastDumpId; dobj->name =3D NULL; /* must be set later */ - dobj->namespace =3D NULL; /* may be set later */ + dobj->namespaceinfo =3D NULL; /* may be set later */ dobj->dump =3D DUMP_COMPONENT_ALL; /* default assumption */ dobj->ext_member =3D false; /* default assumption */ dobj->dependencies =3D NULL; diff --git a/src/bin/pg_dump/parallel.c b/src/bin/pg_dump/parallel.c index be8e018a96..dd8e25382f 100644 --- a/src/bin/pg_dump/parallel.c +++ b/src/bin/pg_dump/parallel.c @@ -384,7 +384,7 @@ archive_close_connection(int code, void *arg) * the other end of the pipe.) */ if (slot->AH) - DisconnectDatabase(&(slot->AH->public)); + DisconnectDatabase(&(slot->AH->archive)); =20 #ifdef WIN32 closesocket(slot->pipeRevRead); @@ -874,7 +874,7 @@ RunWorker(ArchiveHandle *AH, ParallelSlot *slot) * Disconnect from database and clean up. */ set_cancel_slot_archive(slot, NULL); - DisconnectDatabase(&(AH->public)); + DisconnectDatabase(&(AH->archive)); DeCloneArchive(AH); } =20 @@ -911,15 +911,15 @@ ParallelBackupStart(ArchiveHandle *AH) ParallelState *pstate; int i; =20 - Assert(AH->public.numWorkers > 0); + Assert(AH->archive.numWorkers > 0); =20 pstate =3D (ParallelState *) pg_malloc(sizeof(ParallelState)); =20 - pstate->numWorkers =3D AH->public.numWorkers; + pstate->numWorkers =3D AH->archive.numWorkers; pstate->te =3D NULL; pstate->parallelSlot =3D NULL; =20 - if (AH->public.numWorkers =3D=3D 1) + if (AH->archive.numWorkers =3D=3D 1) return pstate; =20 pstate->te =3D (TocEntry **) @@ -1180,7 +1180,7 @@ buildWorkerResponse(ArchiveHandle *AH, TocEntry *te, = T_Action act, int status, snprintf(buf, buflen, "OK %d %d %d", te->dumpId, status, - status =3D=3D WORKER_IGNORED_ERRORS ? AH->public.n_errors : 0); + status =3D=3D WORKER_IGNORED_ERRORS ? AH->archive.n_errors : 0); } =20 /* @@ -1204,7 +1204,7 @@ parseWorkerResponse(ArchiveHandle *AH, TocEntry *te, Assert(dumpId =3D=3D te->dumpId); Assert(nBytes =3D=3D strlen(msg)); =20 - AH->public.n_errors +=3D n_errors; + AH->archive.n_errors +=3D n_errors; } else exit_horribly(modulename, @@ -1332,7 +1332,7 @@ lockTableForWorker(ArchiveHandle *AH, TocEntry *te) =20 query =3D createPQExpBuffer(); =20 - qualId =3D fmtQualifiedId(AH->public.remoteVersion, te->namespace, te->ta= g); + qualId =3D fmtQualifiedId(AH->archive.remoteVersion, te->schema, te->tag); =20 appendPQExpBuffer(query, "LOCK TABLE %s IN ACCESS SHARE MODE NOWAIT", qualId); diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h index a6e84efc38..9a7f21447a 100644 --- a/src/bin/pg_dump/pg_backup.h +++ b/src/bin/pg_dump/pg_backup.h @@ -248,7 +248,7 @@ extern PGconn *GetConnection(Archive *AHX); extern void ArchiveEntry(Archive *AHX, CatalogId catalogId, DumpId dumpId, const char *tag, - const char *namespace, const char *tablespace, + const char *nspname, const char *tablespace, const char *owner, bool withOids, const char *desc, teSection section, const char *defn, diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_back= up_archiver.c index e387293664..54fe6c5bc8 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -258,7 +258,7 @@ void ProcessArchiveRestoreOptions(Archive *AHX) { ArchiveHandle *AH =3D (ArchiveHandle *) AHX; - RestoreOptions *ropt =3D AH->public.ropt; + RestoreOptions *ropt =3D AH->archive.ropt; TocEntry *te; teSection curSection; =20 @@ -315,7 +315,7 @@ void RestoreArchive(Archive *AHX) { ArchiveHandle *AH =3D (ArchiveHandle *) AHX; - RestoreOptions *ropt =3D AH->public.ropt; + RestoreOptions *ropt =3D AH->archive.ropt; bool parallel_mode; TocEntry *te; OutputContext sav; @@ -334,7 +334,7 @@ RestoreArchive(Archive *AHX) /* * If we're going to do parallel restore, there are some restrictions. */ - parallel_mode =3D (AH->public.numWorkers > 1 && ropt->useDB); + parallel_mode =3D (AH->archive.numWorkers > 1 && ropt->useDB); if (parallel_mode) { /* We haven't got round to making this work for all archive formats */ @@ -447,7 +447,7 @@ RestoreArchive(Archive *AHX) =20 ahprintf(AH, "\n"); =20 - if (AH->public.verbose) + if (AH->archive.verbose) dumpTimestamp(AH, "Started on", AH->createDate); =20 if (ropt->single_txn) @@ -498,7 +498,7 @@ RestoreArchive(Archive *AHX) ahlog(AH, 1, "dropping %s %s\n", te->desc, te->tag); /* Select owner and schema as necessary */ _becomeOwner(AH, te); - _selectOutputSchema(AH, te->namespace); + _selectOutputSchema(AH, te->schema); =20 /* * Now emit the DROP command, if the object has one. Note we @@ -663,9 +663,9 @@ RestoreArchive(Archive *AHX) if ((te->reqs & (REQ_SCHEMA | REQ_DATA)) !=3D 0) { /* Show namespace if available */ - if (te->namespace) + if (te->schema) ahlog(AH, 1, "setting owner and privileges for %s \"%s.%s\"\n", - te->desc, te->namespace, te->tag); + te->desc, te->schema, te->tag); else ahlog(AH, 1, "setting owner and privileges for %s \"%s\"\n", te->desc, te->tag); @@ -681,7 +681,7 @@ RestoreArchive(Archive *AHX) ahprintf(AH, "COMMIT;\n\n"); } =20 - if (AH->public.verbose) + if (AH->archive.verbose) dumpTimestamp(AH, "Completed on", time(NULL)); =20 ahprintf(AH, "--\n-- PostgreSQL database dump complete\n--\n\n"); @@ -695,7 +695,7 @@ RestoreArchive(Archive *AHX) RestoreOutput(AH, sav); =20 if (ropt->useDB) - DisconnectDatabase(&AH->public); + DisconnectDatabase(&AH->archive); } =20 /* @@ -708,7 +708,7 @@ RestoreArchive(Archive *AHX) static int restore_toc_entry(ArchiveHandle *AH, TocEntry *te, bool is_parallel) { - RestoreOptions *ropt =3D AH->public.ropt; + RestoreOptions *ropt =3D AH->archive.ropt; int status =3D WORKER_OK; teReqs reqs; bool defnDumped; @@ -743,9 +743,9 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, bool= is_parallel) if ((reqs & REQ_SCHEMA) !=3D 0) /* We want the schema */ { /* Show namespace if available */ - if (te->namespace) + if (te->schema) ahlog(AH, 1, "creating %s \"%s.%s\"\n", - te->desc, te->namespace, te->tag); + te->desc, te->schema, te->tag); else ahlog(AH, 1, "creating %s \"%s\"\n", te->desc, te->tag); =20 @@ -845,10 +845,10 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, bo= ol is_parallel) =20 /* Select owner and schema as necessary */ _becomeOwner(AH, te); - _selectOutputSchema(AH, te->namespace); + _selectOutputSchema(AH, te->schema); =20 ahlog(AH, 1, "processing data for table \"%s.%s\"\n", - te->namespace, te->tag); + te->schema, te->tag); =20 /* * In parallel restore, if we created the table earlier in @@ -864,7 +864,7 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, bool= is_parallel) * Parallel restore is always talking directly to a * server, so no need to see if we should issue BEGIN. */ - StartTransaction(&AH->public); + StartTransaction(&AH->archive); =20 /* * If the server version is >=3D 8.4, make sure we issue @@ -895,12 +895,12 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, bo= ol is_parallel) */ if (AH->outputKind =3D=3D OUTPUT_COPYDATA && RestoringToDB(AH)) - EndDBCopyMode(&AH->public, te->tag); + EndDBCopyMode(&AH->archive, te->tag); AH->outputKind =3D OUTPUT_SQLCMDS; =20 /* close out the transaction started above */ if (is_parallel && te->created) - CommitTransaction(&AH->public); + CommitTransaction(&AH->archive); =20 _enableTriggersIfNecessary(AH, te); } @@ -914,7 +914,7 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, bool= is_parallel) } } =20 - if (AH->public.n_errors > 0 && status =3D=3D WORKER_OK) + if (AH->archive.n_errors > 0 && status =3D=3D WORKER_OK) status =3D WORKER_IGNORED_ERRORS; =20 return status; @@ -942,7 +942,7 @@ NewRestoreOptions(void) static void _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te) { - RestoreOptions *ropt =3D AH->public.ropt; + RestoreOptions *ropt =3D AH->archive.ropt; =20 /* This hack is only needed in a data-only restore */ if (!ropt->dataOnly || !ropt->disable_triggers) @@ -961,7 +961,7 @@ _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry= *te) /* * Disable them. */ - _selectOutputSchema(AH, te->namespace); + _selectOutputSchema(AH, te->schema); =20 ahprintf(AH, "ALTER TABLE %s DISABLE TRIGGER ALL;\n\n", fmtId(te->tag)); @@ -970,7 +970,7 @@ _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry= *te) static void _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te) { - RestoreOptions *ropt =3D AH->public.ropt; + RestoreOptions *ropt =3D AH->archive.ropt; =20 /* This hack is only needed in a data-only restore */ if (!ropt->dataOnly || !ropt->disable_triggers) @@ -989,7 +989,7 @@ _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry = *te) /* * Enable them. */ - _selectOutputSchema(AH, te->namespace); + _selectOutputSchema(AH, te->schema); =20 ahprintf(AH, "ALTER TABLE %s ENABLE TRIGGER ALL;\n\n", fmtId(te->tag)); @@ -1023,7 +1023,7 @@ void ArchiveEntry(Archive *AHX, CatalogId catalogId, DumpId dumpId, const char *tag, - const char *namespace, + const char *nspname, const char *tablespace, const char *owner, bool withOids, const char *desc, teSection section, @@ -1051,7 +1051,7 @@ ArchiveEntry(Archive *AHX, newToc->section =3D section; =20 newToc->tag =3D pg_strdup(tag); - newToc->namespace =3D namespace ? pg_strdup(namespace) : NULL; + newToc->schema =3D nspname ? pg_strdup(nspname) : NULL; newToc->tablespace =3D tablespace ? pg_strdup(tablespace) : NULL; newToc->owner =3D pg_strdup(owner); newToc->withOids =3D withOids; @@ -1087,7 +1087,7 @@ void PrintTOCSummary(Archive *AHX) { ArchiveHandle *AH =3D (ArchiveHandle *) AHX; - RestoreOptions *ropt =3D AH->public.ropt; + RestoreOptions *ropt =3D AH->archive.ropt; TocEntry *te; teSection curSection; OutputContext sav; @@ -1144,7 +1144,7 @@ PrintTOCSummary(Archive *AHX) (_tocEntryRequired(te, curSection, ropt) & (REQ_SCHEMA | REQ_DATA)) != =3D 0) ahprintf(AH, "%d; %u %u %s %s %s %s\n", te->dumpId, te->catalogId.tableoid, te->catalogId.oid, - te->desc, te->namespace ? te->namespace : "-", + te->desc, te->schema ? te->schema : "-", te->tag, te->owner); if (ropt->verbose && te->nDeps > 0) { @@ -1205,12 +1205,12 @@ EndBlob(Archive *AHX, Oid oid) void StartRestoreBlobs(ArchiveHandle *AH) { - RestoreOptions *ropt =3D AH->public.ropt; + RestoreOptions *ropt =3D AH->archive.ropt; =20 if (!ropt->single_txn) { if (AH->connection) - StartTransaction(&AH->public); + StartTransaction(&AH->archive); else ahprintf(AH, "BEGIN;\n\n"); } @@ -1224,12 +1224,12 @@ StartRestoreBlobs(ArchiveHandle *AH) void EndRestoreBlobs(ArchiveHandle *AH) { - RestoreOptions *ropt =3D AH->public.ropt; + RestoreOptions *ropt =3D AH->archive.ropt; =20 if (!ropt->single_txn) { if (AH->connection) - CommitTransaction(&AH->public); + CommitTransaction(&AH->archive); else ahprintf(AH, "COMMIT;\n\n"); } @@ -1318,7 +1318,7 @@ void SortTocFromFile(Archive *AHX) { ArchiveHandle *AH =3D (ArchiveHandle *) AHX; - RestoreOptions *ropt =3D AH->public.ropt; + RestoreOptions *ropt =3D AH->archive.ropt; FILE *fh; char buf[100]; bool incomplete_line; @@ -1587,7 +1587,7 @@ ahlog(ArchiveHandle *AH, int level, const char *fmt,.= ..) { va_list ap; =20 - if (AH->debugLevel < level && (!AH->public.verbose || level > 1)) + if (AH->debugLevel < level && (!AH->archive.verbose || level > 1)) return; =20 va_start(ap, fmt); @@ -1601,7 +1601,7 @@ ahlog(ArchiveHandle *AH, int level, const char *fmt,.= ..) static int RestoringToDB(ArchiveHandle *AH) { - RestoreOptions *ropt =3D AH->public.ropt; + RestoreOptions *ropt =3D AH->archive.ropt; =20 return (ropt && ropt->useDB && AH->connection); } @@ -1689,7 +1689,7 @@ ahwrite(const void *ptr, size_t size, size_t nmemb, A= rchiveHandle *AH) * connected then send it to the DB. */ if (RestoringToDB(AH)) - bytes_written =3D ExecuteSqlCommandBuf(&AH->public, (const char *) ptr,= size * nmemb); + bytes_written =3D ExecuteSqlCommandBuf(&AH->archive, (const char *) ptr= , size * nmemb); else bytes_written =3D fwrite(ptr, size, nmemb, AH->OF) * size; } @@ -1743,10 +1743,10 @@ warn_or_exit_horribly(ArchiveHandle *AH, vwrite_msg(modulename, fmt, ap); va_end(ap); =20 - if (AH->public.exit_on_error) + if (AH->archive.exit_on_error) exit_nicely(1); else - AH->public.n_errors++; + AH->archive.n_errors++; } =20 #ifdef NOT_USED @@ -2256,12 +2256,12 @@ _allocAH(const char *FileSpec, const ArchiveFormat = fmt, AH->version =3D K_VERS_SELF; =20 /* initialize for backwards compatible string processing */ - AH->public.encoding =3D 0; /* PG_SQL_ASCII */ - AH->public.std_strings =3D false; + AH->archive.encoding =3D 0; /* PG_SQL_ASCII */ + AH->archive.std_strings =3D false; =20 /* sql error handling */ - AH->public.exit_on_error =3D true; - AH->public.n_errors =3D 0; + AH->archive.exit_on_error =3D true; + AH->archive.n_errors =3D 0; =20 AH->archiveDumpVersion =3D PG_VERSION; =20 @@ -2483,7 +2483,7 @@ WriteToc(ArchiveHandle *AH) WriteStr(AH, te->defn); WriteStr(AH, te->dropStmt); WriteStr(AH, te->copyStmt); - WriteStr(AH, te->namespace); + WriteStr(AH, te->schema); WriteStr(AH, te->tablespace); WriteStr(AH, te->owner); WriteStr(AH, te->withOids ? "true" : "false"); @@ -2582,7 +2582,7 @@ ReadToc(ArchiveHandle *AH) te->copyStmt =3D ReadStr(AH); =20 if (AH->version >=3D K_VERS_1_6) - te->namespace =3D ReadStr(AH); + te->schema =3D ReadStr(AH); =20 if (AH->version >=3D K_VERS_1_10) te->tablespace =3D ReadStr(AH); @@ -2677,7 +2677,7 @@ processEncodingEntry(ArchiveHandle *AH, TocEntry *te) if (encoding < 0) exit_horribly(modulename, "unrecognized encoding \"%s\"\n", ptr1); - AH->public.encoding =3D encoding; + AH->archive.encoding =3D encoding; } else exit_horribly(modulename, "invalid ENCODING item: %s\n", @@ -2694,9 +2694,9 @@ processStdStringsEntry(ArchiveHandle *AH, TocEntry *t= e) =20 ptr1 =3D strchr(te->defn, '\''); if (ptr1 && strncmp(ptr1, "'on'", 4) =3D=3D 0) - AH->public.std_strings =3D true; + AH->archive.std_strings =3D true; else if (ptr1 && strncmp(ptr1, "'off'", 5) =3D=3D 0) - AH->public.std_strings =3D false; + AH->archive.std_strings =3D false; else exit_horribly(modulename, "invalid STDSTRINGS item: %s\n", te->defn); @@ -2787,15 +2787,15 @@ _tocEntryRequired(TocEntry *te, teSection curSectio= n, RestoreOptions *ropt) if (ropt->schemaNames.head !=3D NULL) { /* If no namespace is specified, it means all. */ - if (!te->namespace) + if (!te->schema) return 0; - if (!(simple_string_list_member(&ropt->schemaNames, te->namespace))) + if (!(simple_string_list_member(&ropt->schemaNames, te->schema))) return 0; } =20 if (ropt->schemaExcludeNames.head !=3D NULL && - te->namespace && - simple_string_list_member(&ropt->schemaExcludeNames, te->namespace)) + te->schema && + simple_string_list_member(&ropt->schemaExcludeNames, te->schema)) return 0; =20 if (ropt->selTypes) @@ -2914,7 +2914,7 @@ _tocEntryIsACL(TocEntry *te) static void _doSetFixedOutputState(ArchiveHandle *AH) { - RestoreOptions *ropt =3D AH->public.ropt; + RestoreOptions *ropt =3D AH->archive.ropt; =20 /* * Disable timeouts to allow for slow commands, idle parallel workers, etc @@ -2925,11 +2925,11 @@ _doSetFixedOutputState(ArchiveHandle *AH) =20 /* Select the correct character set encoding */ ahprintf(AH, "SET client_encoding =3D '%s';\n", - pg_encoding_to_char(AH->public.encoding)); + pg_encoding_to_char(AH->archive.encoding)); =20 /* Select the correct string literal syntax */ ahprintf(AH, "SET standard_conforming_strings =3D %s;\n", - AH->public.std_strings ? "on" : "off"); + AH->archive.std_strings ? "on" : "off"); =20 /* Select the role to be used during restore */ if (ropt && ropt->use_role) @@ -2940,7 +2940,7 @@ _doSetFixedOutputState(ArchiveHandle *AH) =20 /* Avoid annoying notices etc */ ahprintf(AH, "SET client_min_messages =3D warning;\n"); - if (!AH->public.std_strings) + if (!AH->archive.std_strings) ahprintf(AH, "SET escape_string_warning =3D off;\n"); =20 /* Adjust row-security state */ @@ -3107,7 +3107,7 @@ _becomeUser(ArchiveHandle *AH, const char *user) static void _becomeOwner(ArchiveHandle *AH, TocEntry *te) { - RestoreOptions *ropt =3D AH->public.ropt; + RestoreOptions *ropt =3D AH->archive.ropt; =20 if (ropt && (ropt->noOwner || !ropt->use_setsessauth)) return; @@ -3180,7 +3180,7 @@ _selectOutputSchema(ArchiveHandle *AH, const char *sc= hemaName) static void _selectTablespace(ArchiveHandle *AH, const char *tablespace) { - RestoreOptions *ropt =3D AH->public.ropt; + RestoreOptions *ropt =3D AH->archive.ropt; PQExpBuffer qry; const char *want, *have; @@ -3316,7 +3316,7 @@ _getObjectDescription(PQExpBuffer buf, TocEntry *te, = ArchiveHandle *AH) static void _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData, bool acl_pass) { - RestoreOptions *ropt =3D AH->public.ropt; + RestoreOptions *ropt =3D AH->archive.ropt; =20 /* ACLs are dumped only during acl pass */ if (acl_pass) @@ -3355,7 +3355,7 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool = isData, bool acl_pass) =20 /* Select owner, schema, and tablespace as necessary */ _becomeOwner(AH, te); - _selectOutputSchema(AH, te->namespace); + _selectOutputSchema(AH, te->schema); _selectTablespace(AH, te->tablespace); =20 /* Set up OID mode too */ @@ -3376,7 +3376,7 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool = isData, bool acl_pass) pfx =3D ""; =20 ahprintf(AH, "--\n"); - if (AH->public.verbose) + if (AH->archive.verbose) { ahprintf(AH, "-- TOC entry %d (class %u OID %u)\n", te->dumpId, te->catalogId.tableoid, te->catalogId.oid); @@ -3398,8 +3398,8 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool = isData, bool acl_pass) * dump containing objects with maliciously crafted names). */ sanitized_name =3D replace_line_endings(te->tag); - if (te->namespace) - sanitized_schema =3D replace_line_endings(te->namespace); + if (te->schema) + sanitized_schema =3D replace_line_endings(te->schema); else sanitized_schema =3D pg_strdup("-"); if (!ropt->noOwner) @@ -3565,7 +3565,7 @@ WriteHead(ArchiveHandle *AH) WriteInt(AH, crtm.tm_year); WriteInt(AH, crtm.tm_isdst); WriteStr(AH, PQdb(AH->connection)); - WriteStr(AH, AH->public.remoteVersionStr); + WriteStr(AH, AH->archive.remoteVersionStr); WriteStr(AH, PG_VERSION); } =20 @@ -3791,7 +3791,7 @@ restore_toc_entries_prefork(ArchiveHandle *AH) * mainly to ensure that we don't exceed the specified number of parallel * connections. */ - DisconnectDatabase(&AH->public); + DisconnectDatabase(&AH->archive); =20 /* blow away any transient state from the old connection */ if (AH->currUser) @@ -3932,7 +3932,7 @@ restore_toc_entries_parallel(ArchiveHandle *AH, Paral= lelState *pstate, static void restore_toc_entries_postfork(ArchiveHandle *AH, TocEntry *pending_list) { - RestoreOptions *ropt =3D AH->public.ropt; + RestoreOptions *ropt =3D AH->archive.ropt; TocEntry *te; =20 ahlog(AH, 2, "entering restore_toc_entries_postfork\n"); @@ -4126,7 +4126,7 @@ parallel_restore(ArchiveHandle *AH, TocEntry *te) Assert(AH->connection !=3D NULL); =20 /* Count only errors associated with this TOC entry */ - AH->public.n_errors =3D 0; + AH->archive.n_errors =3D 0; =20 /* Restore the TOC item */ status =3D restore_toc_entry(AH, te, true); @@ -4157,10 +4157,10 @@ mark_restore_job_done(ArchiveHandle *AH, else if (status =3D=3D WORKER_INHIBIT_DATA) { inhibit_data_for_failed_table(AH, te); - AH->public.n_errors++; + AH->archive.n_errors++; } else if (status =3D=3D WORKER_IGNORED_ERRORS) - AH->public.n_errors++; + AH->archive.n_errors++; else if (status !=3D 0) exit_horribly(modulename, "worker process failed: exit code %d\n", status); @@ -4478,7 +4478,7 @@ CloneArchive(ArchiveHandle *AH) clone->savedPassword =3D pg_strdup(clone->savedPassword); =20 /* clone has its own error count, too */ - clone->public.n_errors =3D 0; + clone->archive.n_errors =3D 0; =20 /* * Connect our new clone object to the database: In parallel restore the @@ -4488,7 +4488,7 @@ CloneArchive(ArchiveHandle *AH) */ if (AH->mode =3D=3D archModeRead) { - RestoreOptions *ropt =3D AH->public.ropt; + RestoreOptions *ropt =3D AH->archive.ropt; =20 Assert(AH->connection =3D=3D NULL); =20 diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_back= up_archiver.h index 81f0db8d3c..ac2ebb7eea 100644 --- a/src/bin/pg_dump/pg_backup_archiver.h +++ b/src/bin/pg_dump/pg_backup_archiver.h @@ -212,7 +212,7 @@ typedef enum =20 struct _archiveHandle { - Archive public; /* Public part of archive */ + Archive archive; /* Public part of archive */ int version; /* Version of file */ =20 char *archiveRemoteVersion; /* When reading an archive, the @@ -342,7 +342,7 @@ struct _tocEntry bool hadDumper; /* Archiver was passed a dumper routine (used * in restore) */ char *tag; /* index tag */ - char *namespace; /* null or empty string if not in a schema */ + char *schema; /* null or empty string if not in a schema */ char *tablespace; /* null if not in a tablespace; empty string * means use database default */ char *owner; @@ -393,10 +393,10 @@ TocEntry *getTocEntryByDumpId(ArchiveHandle *AH, Du= mpId id); extern bool checkSeek(FILE *fp); =20 #define appendStringLiteralAHX(buf,str,AH) \ - appendStringLiteral(buf, str, (AH)->public.encoding, (AH)->public.std_str= ings) + appendStringLiteral(buf, str, (AH)->archive.encoding, (AH)->archive.std_s= trings) =20 #define appendByteaLiteralAHX(buf,str,len,AH) \ - appendByteaLiteral(buf, str, len, (AH)->public.std_strings) + appendByteaLiteral(buf, str, len, (AH)->archive.std_strings) =20 /* * Mandatory routines for each supported format diff --git a/src/bin/pg_dump/pg_backup_custom.c b/src/bin/pg_dump/pg_backup= _custom.c index 5737608f9e..b99c43772c 100644 --- a/src/bin/pg_dump/pg_backup_custom.c +++ b/src/bin/pg_dump/pg_backup_custom.c @@ -272,7 +272,7 @@ _PrintExtraToc(ArchiveHandle *AH, TocEntry *te) { lclTocEntry *ctx =3D (lclTocEntry *) te->formatData; =20 - if (AH->public.verbose) + if (AH->archive.verbose) ahprintf(AH, "-- Data Pos: " INT64_FORMAT "\n", (int64) ctx->dataPos); } @@ -495,7 +495,7 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te) break; =20 case BLK_BLOBS: - _LoadBlobs(AH, AH->public.ropt->dropSchema); + _LoadBlobs(AH, AH->archive.ropt->dropSchema); break; =20 default: /* Always have a default */ diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c index 3b9cd89b4a..9286c6af0e 100644 --- a/src/bin/pg_dump/pg_backup_db.c +++ b/src/bin/pg_dump/pg_backup_db.c @@ -46,14 +46,14 @@ _check_database_version(ArchiveHandle *AH) if (remoteversion =3D=3D 0 || !remoteversion_str) exit_horribly(modulename, "could not get server_version from libpq\n"); =20 - AH->public.remoteVersionStr =3D pg_strdup(remoteversion_str); - AH->public.remoteVersion =3D remoteversion; + AH->archive.remoteVersionStr =3D pg_strdup(remoteversion_str); + AH->archive.remoteVersion =3D remoteversion; if (!AH->archiveRemoteVersion) - AH->archiveRemoteVersion =3D AH->public.remoteVersionStr; + AH->archiveRemoteVersion =3D AH->archive.remoteVersionStr; =20 if (remoteversion !=3D PG_VERSION_NUM - && (remoteversion < AH->public.minRemoteVersion || - remoteversion > AH->public.maxRemoteVersion)) + && (remoteversion < AH->archive.minRemoteVersion || + remoteversion > AH->archive.maxRemoteVersion)) { write_msg(NULL, "server version: %s; %s version: %s\n", remoteversion_str, progname, PG_VERSION); @@ -68,11 +68,11 @@ _check_database_version(ArchiveHandle *AH) { res =3D ExecuteSqlQueryForSingleRow((Archive *) AH, "SELECT pg_catalog.p= g_is_in_recovery()"); =20 - AH->public.isStandby =3D (strcmp(PQgetvalue(res, 0, 0), "t") =3D=3D 0); + AH->archive.isStandby =3D (strcmp(PQgetvalue(res, 0, 0), "t") =3D=3D 0); PQclear(res); } else - AH->public.isStandby =3D false; + AH->archive.isStandby =3D false; } =20 /* @@ -551,7 +551,7 @@ ExecuteSimpleCommands(ArchiveHandle *AH, const char *bu= f, size_t bufLen) /* We needn't handle '' specially */ if (ch =3D=3D '\'' && !AH->sqlparse.backSlash) AH->sqlparse.state =3D SQL_SCAN; - else if (ch =3D=3D '\\' && !AH->public.std_strings) + else if (ch =3D=3D '\\' && !AH->archive.std_strings) AH->sqlparse.backSlash =3D !AH->sqlparse.backSlash; else AH->sqlparse.backSlash =3D false; diff --git a/src/bin/pg_dump/pg_backup_directory.c b/src/bin/pg_dump/pg_bac= kup_directory.c index 0d7322f73a..4e255ca4a6 100644 --- a/src/bin/pg_dump/pg_backup_directory.c +++ b/src/bin/pg_dump/pg_backup_directory.c @@ -308,7 +308,7 @@ _PrintExtraToc(ArchiveHandle *AH, TocEntry *te) { lclTocEntry *tctx =3D (lclTocEntry *) te->formatData; =20 - if (AH->public.verbose && tctx->filename) + if (AH->archive.verbose && tctx->filename) ahprintf(AH, "-- File: %s\n", tctx->filename); } =20 @@ -458,7 +458,7 @@ _LoadBlobs(ArchiveHandle *AH) exit_horribly(modulename, "invalid line in large object TOC file \"%s\"= : \"%s\"\n", fname, line); =20 - StartRestoreBlob(AH, oid, AH->public.ropt->dropSchema); + StartRestoreBlob(AH, oid, AH->archive.ropt->dropSchema); snprintf(path, MAXPGPATH, "%s/%s", ctx->directory, fname); _PrintFileData(AH, path); EndRestoreBlob(AH, oid); diff --git a/src/bin/pg_dump/pg_backup_null.c b/src/bin/pg_dump/pg_backup_n= ull.c index ff419bb82f..ae8374292d 100644 --- a/src/bin/pg_dump/pg_backup_null.c +++ b/src/bin/pg_dump/pg_backup_null.c @@ -150,7 +150,7 @@ _StartBlob(ArchiveHandle *AH, TocEntry *te, Oid oid) exit_horribly(NULL, "invalid OID for large object\n"); =20 /* With an old archive we must do drop and create logic here */ - if (old_blob_style && AH->public.ropt->dropSchema) + if (old_blob_style && AH->archive.ropt->dropSchema) DropBlobIfExists(AH, oid); =20 if (old_blob_style) diff --git a/src/bin/pg_dump/pg_backup_tar.c b/src/bin/pg_dump/pg_backup_ta= r.c index 9cadd0c4a4..27b4d62476 100644 --- a/src/bin/pg_dump/pg_backup_tar.c +++ b/src/bin/pg_dump/pg_backup_tar.c @@ -315,7 +315,7 @@ _PrintExtraToc(ArchiveHandle *AH, TocEntry *te) { lclTocEntry *ctx =3D (lclTocEntry *) te->formatData; =20 - if (AH->public.verbose && ctx->filename !=3D NULL) + if (AH->archive.verbose && ctx->filename !=3D NULL) ahprintf(AH, "-- File: %s\n", ctx->filename); } =20 @@ -735,7 +735,7 @@ _LoadBlobs(ArchiveHandle *AH) { ahlog(AH, 1, "restoring large object with OID %u\n", oid); =20 - StartRestoreBlob(AH, oid, AH->public.ropt->dropSchema); + StartRestoreBlob(AH, oid, AH->archive.ropt->dropSchema); =20 while ((cnt =3D tarRead(buf, 4095, th)) > 0) { @@ -868,26 +868,26 @@ _CloseArchive(ArchiveHandle *AH) ctx->scriptTH =3D th; =20 ropt =3D NewRestoreOptions(); - memcpy(ropt, AH->public.ropt, sizeof(RestoreOptions)); + memcpy(ropt, AH->archive.ropt, sizeof(RestoreOptions)); ropt->filename =3D NULL; ropt->dropSchema =3D 1; ropt->compression =3D 0; ropt->superuser =3D NULL; ropt->suppressDumpWarnings =3D true; =20 - savDopt =3D AH->public.dopt; - savRopt =3D AH->public.ropt; + savDopt =3D AH->archive.dopt; + savRopt =3D AH->archive.ropt; =20 SetArchiveOptions((Archive *) AH, NULL, ropt); =20 - savVerbose =3D AH->public.verbose; - AH->public.verbose =3D 0; + savVerbose =3D AH->archive.verbose; + AH->archive.verbose =3D 0; =20 RestoreArchive((Archive *) AH); =20 SetArchiveOptions((Archive *) AH, savDopt, savRopt); =20 - AH->public.verbose =3D savVerbose; + AH->archive.verbose =3D savVerbose; =20 tarClose(AH, th); =20 diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 7273ec8fe2..0b8c7d22a5 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -147,13 +147,13 @@ static void dumpTableData(Archive *fout, TableDataInf= o *tdinfo); static void refreshMatViewData(Archive *fout, TableDataInfo *tdinfo); static void guessConstraintInheritance(TableInfo *tblinfo, int numTables); static void dumpComment(Archive *fout, const char *target, - const char *namespace, const char *owner, + const char *nspname, const char *owner, CatalogId catalogId, int subid, DumpId dumpId); static int findComments(Archive *fout, Oid classoid, Oid objoid, CommentItem **items); static int collectComments(Archive *fout, CommentItem **items); static void dumpSecLabel(Archive *fout, const char *target, - const char *namespace, const char *owner, + const char *nspname, const char *owner, CatalogId catalogId, int subid, DumpId dumpId); static int findSecLabels(Archive *fout, Oid classoid, Oid objoid, SecLabelItem **items); @@ -199,7 +199,7 @@ static void dumpTSConfig(Archive *fout, TSConfigInfo *c= fginfo); static void dumpForeignDataWrapper(Archive *fout, FdwInfo *fdwinfo); static void dumpForeignServer(Archive *fout, ForeignServerInfo *srvinfo); static void dumpUserMappings(Archive *fout, - const char *servername, const char *namespace, + const char *servername, const char *nspname, const char *owner, CatalogId catalogId, DumpId dumpId); static void dumpDefaultACL(Archive *fout, DefaultACLInfo *daclinfo); =20 @@ -1420,7 +1420,7 @@ selectDumpableTable(TableInfo *tbinfo, Archive *fout) tbinfo->dobj.catId.oid) ? DUMP_COMPONENT_ALL : DUMP_COMPONENT_NONE; else - tbinfo->dobj.dump =3D tbinfo->dobj.namespace->dobj.dump_contains; + tbinfo->dobj.dump =3D tbinfo->dobj.namespaceinfo->dobj.dump_contains; =20 /* * In any case, a table can be excluded by an exclusion switch @@ -1478,7 +1478,7 @@ selectDumpableType(TypeInfo *tyinfo, Archive *fout) return; /* extension membership overrides all else */ =20 /* Dump based on if the contents of the namespace are being dumped */ - tyinfo->dobj.dump =3D tyinfo->dobj.namespace->dobj.dump_contains; + tyinfo->dobj.dump =3D tyinfo->dobj.namespaceinfo->dobj.dump_contains; } =20 /* @@ -1494,9 +1494,9 @@ selectDumpableDefaultACL(DefaultACLInfo *dinfo, DumpO= ptions *dopt) { /* Default ACLs can't be extension members */ =20 - if (dinfo->dobj.namespace) + if (dinfo->dobj.namespaceinfo) /* default ACLs are considered part of the namespace */ - dinfo->dobj.dump =3D dinfo->dobj.namespace->dobj.dump_contains; + dinfo->dobj.dump =3D dinfo->dobj.namespaceinfo->dobj.dump_contains; else dinfo->dobj.dump =3D dopt->include_everything ? DUMP_COMPONENT_ALL : DUMP_COMPONENT_NONE; @@ -1628,8 +1628,8 @@ selectDumpableObject(DumpableObject *dobj, Archive *f= out) * Default policy is to dump if parent namespace is dumpable, or for * non-namespace-associated items, dump if we're dumping "everything". */ - if (dobj->namespace) - dobj->dump =3D dobj->namespace->dobj.dump_contains; + if (dobj->namespaceinfo) + dobj->dump =3D dobj->namespaceinfo->dobj.dump_contains; else dobj->dump =3D fout->dopt->include_everything ? DUMP_COMPONENT_ALL : DUMP_COMPONENT_NONE; @@ -1664,7 +1664,7 @@ dumpTableData_copy(Archive *fout, void *dcontext) =20 if (g_verbose) write_msg(NULL, "dumping contents of table \"%s.%s\"\n", - tbinfo->dobj.namespace->dobj.name, classname); + tbinfo->dobj.namespaceinfo->dobj.name, classname); =20 /* * Make sure we are in proper schema. We will qualify the table name @@ -1672,7 +1672,7 @@ dumpTableData_copy(Archive *fout, void *dcontext) * this ensures reproducible results in case the table contains regproc, * regclass, etc columns. */ - selectSourceSchema(fout, tbinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tbinfo->dobj.namespaceinfo->dobj.name); =20 /* * Specify the column list explicitly so that we have no possibility of @@ -1686,7 +1686,7 @@ dumpTableData_copy(Archive *fout, void *dcontext) { appendPQExpBuffer(q, "COPY %s %s WITH OIDS TO stdout;", fmtQualifiedId(fout->remoteVersion, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, classname), column_list); } @@ -1704,7 +1704,7 @@ dumpTableData_copy(Archive *fout, void *dcontext) appendPQExpBufferStr(q, "* "); appendPQExpBuffer(q, "FROM %s %s) TO stdout;", fmtQualifiedId(fout->remoteVersion, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, classname), tdinfo->filtercond); } @@ -1712,7 +1712,7 @@ dumpTableData_copy(Archive *fout, void *dcontext) { appendPQExpBuffer(q, "COPY %s %s TO stdout;", fmtQualifiedId(fout->remoteVersion, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, classname), column_list); } @@ -1838,12 +1838,12 @@ dumpTableData_insert(Archive *fout, void *dcontext) * this ensures reproducible results in case the table contains regproc, * regclass, etc columns. */ - selectSourceSchema(fout, tbinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tbinfo->dobj.namespaceinfo->dobj.name); =20 appendPQExpBuffer(q, "DECLARE _pg_dump_cursor CURSOR FOR " "SELECT * FROM ONLY %s", fmtQualifiedId(fout->remoteVersion, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, classname)); if (tdinfo->filtercond) appendPQExpBuffer(q, " %s", tdinfo->filtercond); @@ -2030,7 +2030,7 @@ dumpTableData(Archive *fout, TableDataInfo *tdinfo) */ if (tdinfo->dobj.dump & DUMP_COMPONENT_DATA) ArchiveEntry(fout, tdinfo->dobj.catId, tdinfo->dobj.dumpId, - tbinfo->dobj.name, tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.name, tbinfo->dobj.namespaceinfo->dobj.name, NULL, tbinfo->rolname, false, "TABLE DATA", SECTION_DATA, "", "", copyStmt, @@ -2068,7 +2068,7 @@ refreshMatViewData(Archive *fout, TableDataInfo *tdin= fo) tdinfo->dobj.catId, /* catalog ID */ tdinfo->dobj.dumpId, /* dump ID */ tbinfo->dobj.name, /* Name */ - tbinfo->dobj.namespace->dobj.name, /* Namespace */ + tbinfo->dobj.namespaceinfo->dobj.name, /* Namespace */ NULL, /* Tablespace */ tbinfo->rolname, /* Owner */ false, /* with oids */ @@ -2158,7 +2158,7 @@ makeTableDataInfo(DumpOptions *dopt, TableInfo *tbinf= o, bool oids) tdinfo->dobj.catId.oid =3D tbinfo->dobj.catId.oid; AssignDumpId(&tdinfo->dobj); tdinfo->dobj.name =3D tbinfo->dobj.name; - tdinfo->dobj.namespace =3D tbinfo->dobj.namespace; + tdinfo->dobj.namespaceinfo =3D tbinfo->dobj.namespaceinfo; tdinfo->tdtable =3D tbinfo; tdinfo->oids =3D oids; tdinfo->filtercond =3D NULL; /* might get set later */ @@ -3091,7 +3091,7 @@ getPolicies(Archive *fout, TableInfo tblinfo[], int n= umTables) =20 if (g_verbose) write_msg(NULL, "reading row security enabled for table \"%s.%s\"\n", - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, tbinfo->dobj.name); =20 /* @@ -3110,7 +3110,7 @@ getPolicies(Archive *fout, TableInfo tblinfo[], int n= umTables) polinfo->dobj.catId.tableoid =3D 0; polinfo->dobj.catId.oid =3D tbinfo->dobj.catId.oid; AssignDumpId(&polinfo->dobj); - polinfo->dobj.namespace =3D tbinfo->dobj.namespace; + polinfo->dobj.namespaceinfo =3D tbinfo->dobj.namespaceinfo; polinfo->dobj.name =3D pg_strdup(tbinfo->dobj.name); polinfo->poltable =3D tbinfo; polinfo->polname =3D NULL; @@ -3123,13 +3123,13 @@ getPolicies(Archive *fout, TableInfo tblinfo[], int= numTables) =20 if (g_verbose) write_msg(NULL, "reading policies for table \"%s.%s\"\n", - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, tbinfo->dobj.name); =20 /* * select table schema to ensure regproc name is qualified if needed */ - selectSourceSchema(fout, tbinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tbinfo->dobj.namespaceinfo->dobj.name); =20 resetPQExpBuffer(query); =20 @@ -3187,7 +3187,7 @@ getPolicies(Archive *fout, TableInfo tblinfo[], int n= umTables) atooid(PQgetvalue(res, j, i_tableoid)); polinfo[j].dobj.catId.oid =3D atooid(PQgetvalue(res, j, i_oid)); AssignDumpId(&polinfo[j].dobj); - polinfo[j].dobj.namespace =3D tbinfo->dobj.namespace; + polinfo[j].dobj.namespaceinfo =3D tbinfo->dobj.namespaceinfo; polinfo[j].poltable =3D tbinfo; polinfo[j].polname =3D pg_strdup(PQgetvalue(res, j, i_polname)); polinfo[j].dobj.name =3D pg_strdup(polinfo[j].polname); @@ -3248,7 +3248,7 @@ dumpPolicy(Archive *fout, PolicyInfo *polinfo) if (polinfo->dobj.dump & DUMP_COMPONENT_POLICY) ArchiveEntry(fout, polinfo->dobj.catId, polinfo->dobj.dumpId, polinfo->dobj.name, - polinfo->dobj.namespace->dobj.name, + polinfo->dobj.namespaceinfo->dobj.name, NULL, tbinfo->rolname, false, "ROW SECURITY", SECTION_POST_DATA, @@ -3304,7 +3304,7 @@ dumpPolicy(Archive *fout, PolicyInfo *polinfo) if (polinfo->dobj.dump & DUMP_COMPONENT_POLICY) ArchiveEntry(fout, polinfo->dobj.catId, polinfo->dobj.dumpId, tag, - polinfo->dobj.namespace->dobj.name, + polinfo->dobj.namespaceinfo->dobj.name, NULL, tbinfo->rolname, false, "POLICY", SECTION_POST_DATA, @@ -3492,7 +3492,7 @@ getPublicationTables(Archive *fout, TableInfo tblinfo= [], int numTables) =20 if (g_verbose) write_msg(NULL, "reading publication membership for table \"%s.%s\"\n", - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, tbinfo->dobj.name); =20 resetPQExpBuffer(query); @@ -3531,7 +3531,7 @@ getPublicationTables(Archive *fout, TableInfo tblinfo= [], int numTables) atooid(PQgetvalue(res, j, i_tableoid)); pubrinfo[j].dobj.catId.oid =3D atooid(PQgetvalue(res, j, i_oid)); AssignDumpId(&pubrinfo[j].dobj); - pubrinfo[j].dobj.namespace =3D tbinfo->dobj.namespace; + pubrinfo[j].dobj.namespaceinfo =3D tbinfo->dobj.namespaceinfo; pubrinfo[j].pubname =3D pg_strdup(PQgetvalue(res, j, i_pubname)); pubrinfo[j].pubtable =3D tbinfo; } @@ -3570,7 +3570,7 @@ dumpPublicationTable(Archive *fout, PublicationRelInf= o *pubrinfo) */ ArchiveEntry(fout, pubrinfo->dobj.catId, pubrinfo->dobj.dumpId, tag, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, NULL, "", false, "PUBLICATION TABLE", SECTION_POST_DATA, @@ -4140,7 +4140,7 @@ getExtensions(Archive *fout, int *numExtensions) extinfo[i].dobj.catId.oid =3D atooid(PQgetvalue(res, i, i_oid)); AssignDumpId(&extinfo[i].dobj); extinfo[i].dobj.name =3D pg_strdup(PQgetvalue(res, i, i_extname)); - extinfo[i].namespace =3D pg_strdup(PQgetvalue(res, i, i_nspname)); + extinfo[i].extschema =3D pg_strdup(PQgetvalue(res, i, i_nspname)); extinfo[i].relocatable =3D *(PQgetvalue(res, i, i_extrelocatable)) =3D= =3D 't'; extinfo[i].extversion =3D pg_strdup(PQgetvalue(res, i, i_extversion)); extinfo[i].extconfig =3D pg_strdup(PQgetvalue(res, i, i_extconfig)); @@ -4327,7 +4327,7 @@ getTypes(Archive *fout, int *numTypes) tyinfo[i].dobj.catId.oid =3D atooid(PQgetvalue(res, i, i_oid)); AssignDumpId(&tyinfo[i].dobj); tyinfo[i].dobj.name =3D pg_strdup(PQgetvalue(res, i, i_typname)); - tyinfo[i].dobj.namespace =3D + tyinfo[i].dobj.namespaceinfo =3D findNamespace(fout, atooid(PQgetvalue(res, i, i_typnamespace))); tyinfo[i].rolname =3D pg_strdup(PQgetvalue(res, i, i_rolname)); @@ -4388,7 +4388,7 @@ getTypes(Archive *fout, int *numTypes) stinfo->dobj.catId =3D nilCatalogId; AssignDumpId(&stinfo->dobj); stinfo->dobj.name =3D pg_strdup(tyinfo[i].dobj.name); - stinfo->dobj.namespace =3D tyinfo[i].dobj.namespace; + stinfo->dobj.namespaceinfo =3D tyinfo[i].dobj.namespaceinfo; stinfo->baseType =3D &(tyinfo[i]); tyinfo[i].shellType =3D stinfo; =20 @@ -4475,7 +4475,7 @@ getOperators(Archive *fout, int *numOprs) oprinfo[i].dobj.catId.oid =3D atooid(PQgetvalue(res, i, i_oid)); AssignDumpId(&oprinfo[i].dobj); oprinfo[i].dobj.name =3D pg_strdup(PQgetvalue(res, i, i_oprname)); - oprinfo[i].dobj.namespace =3D + oprinfo[i].dobj.namespaceinfo =3D findNamespace(fout, atooid(PQgetvalue(res, i, i_oprnamespace))); oprinfo[i].rolname =3D pg_strdup(PQgetvalue(res, i, i_rolname)); @@ -4564,7 +4564,7 @@ getCollations(Archive *fout, int *numCollations) collinfo[i].dobj.catId.oid =3D atooid(PQgetvalue(res, i, i_oid)); AssignDumpId(&collinfo[i].dobj); collinfo[i].dobj.name =3D pg_strdup(PQgetvalue(res, i, i_collname)); - collinfo[i].dobj.namespace =3D + collinfo[i].dobj.namespaceinfo =3D findNamespace(fout, atooid(PQgetvalue(res, i, i_collnamespace))); collinfo[i].rolname =3D pg_strdup(PQgetvalue(res, i, i_rolname)); @@ -4640,7 +4640,7 @@ getConversions(Archive *fout, int *numConversions) convinfo[i].dobj.catId.oid =3D atooid(PQgetvalue(res, i, i_oid)); AssignDumpId(&convinfo[i].dobj); convinfo[i].dobj.name =3D pg_strdup(PQgetvalue(res, i, i_conname)); - convinfo[i].dobj.namespace =3D + convinfo[i].dobj.namespaceinfo =3D findNamespace(fout, atooid(PQgetvalue(res, i, i_connamespace))); convinfo[i].rolname =3D pg_strdup(PQgetvalue(res, i, i_rolname)); @@ -4717,7 +4717,7 @@ getAccessMethods(Archive *fout, int *numAccessMethods) aminfo[i].dobj.catId.oid =3D atooid(PQgetvalue(res, i, i_oid)); AssignDumpId(&aminfo[i].dobj); aminfo[i].dobj.name =3D pg_strdup(PQgetvalue(res, i, i_amname)); - aminfo[i].dobj.namespace =3D NULL; + aminfo[i].dobj.namespaceinfo =3D NULL; aminfo[i].amhandler =3D pg_strdup(PQgetvalue(res, i, i_amhandler)); aminfo[i].amtype =3D *(PQgetvalue(res, i, i_amtype)); =20 @@ -4791,7 +4791,7 @@ getOpclasses(Archive *fout, int *numOpclasses) opcinfo[i].dobj.catId.oid =3D atooid(PQgetvalue(res, i, i_oid)); AssignDumpId(&opcinfo[i].dobj); opcinfo[i].dobj.name =3D pg_strdup(PQgetvalue(res, i, i_opcname)); - opcinfo[i].dobj.namespace =3D + opcinfo[i].dobj.namespaceinfo =3D findNamespace(fout, atooid(PQgetvalue(res, i, i_opcnamespace))); opcinfo[i].rolname =3D pg_strdup(PQgetvalue(res, i, i_rolname)); @@ -4878,7 +4878,7 @@ getOpfamilies(Archive *fout, int *numOpfamilies) opfinfo[i].dobj.catId.oid =3D atooid(PQgetvalue(res, i, i_oid)); AssignDumpId(&opfinfo[i].dobj); opfinfo[i].dobj.name =3D pg_strdup(PQgetvalue(res, i, i_opfname)); - opfinfo[i].dobj.namespace =3D + opfinfo[i].dobj.namespaceinfo =3D findNamespace(fout, atooid(PQgetvalue(res, i, i_opfnamespace))); opfinfo[i].rolname =3D pg_strdup(PQgetvalue(res, i, i_rolname)); @@ -5052,7 +5052,7 @@ getAggregates(Archive *fout, int *numAggs) agginfo[i].aggfn.dobj.catId.oid =3D atooid(PQgetvalue(res, i, i_oid)); AssignDumpId(&agginfo[i].aggfn.dobj); agginfo[i].aggfn.dobj.name =3D pg_strdup(PQgetvalue(res, i, i_aggname)); - agginfo[i].aggfn.dobj.namespace =3D + agginfo[i].aggfn.dobj.namespaceinfo =3D findNamespace(fout, atooid(PQgetvalue(res, i, i_aggnamespace))); agginfo[i].aggfn.rolname =3D pg_strdup(PQgetvalue(res, i, i_rolname)); @@ -5285,7 +5285,7 @@ getFuncs(Archive *fout, int *numFuncs) finfo[i].dobj.catId.oid =3D atooid(PQgetvalue(res, i, i_oid)); AssignDumpId(&finfo[i].dobj); finfo[i].dobj.name =3D pg_strdup(PQgetvalue(res, i, i_proname)); - finfo[i].dobj.namespace =3D + finfo[i].dobj.namespaceinfo =3D findNamespace(fout, atooid(PQgetvalue(res, i, i_pronamespace))); finfo[i].rolname =3D pg_strdup(PQgetvalue(res, i, i_rolname)); @@ -5927,7 +5927,7 @@ getTables(Archive *fout, int *numTables) tblinfo[i].dobj.catId.oid =3D atooid(PQgetvalue(res, i, i_reloid)); AssignDumpId(&tblinfo[i].dobj); tblinfo[i].dobj.name =3D pg_strdup(PQgetvalue(res, i, i_relname)); - tblinfo[i].dobj.namespace =3D + tblinfo[i].dobj.namespaceinfo =3D findNamespace(fout, atooid(PQgetvalue(res, i, i_relnamespace))); tblinfo[i].rolname =3D pg_strdup(PQgetvalue(res, i, i_rolname)); @@ -6026,7 +6026,7 @@ getTables(Archive *fout, int *numTables) appendPQExpBuffer(query, "LOCK TABLE %s IN ACCESS SHARE MODE", fmtQualifiedId(fout->remoteVersion, - tblinfo[i].dobj.namespace->dobj.name, + tblinfo[i].dobj.namespaceinfo->dobj.name, tblinfo[i].dobj.name)); ExecuteSqlStatement(fout, query->data); } @@ -6276,11 +6276,11 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int = numTables) =20 if (g_verbose) write_msg(NULL, "reading indexes for table \"%s.%s\"\n", - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, tbinfo->dobj.name); =20 /* Make sure we are in proper schema so indexdef is right */ - selectSourceSchema(fout, tbinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tbinfo->dobj.namespaceinfo->dobj.name); =20 /* * The point of the messy-looking outer join is to find a constraint @@ -6451,7 +6451,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int nu= mTables) indxinfo[j].dobj.catId.oid =3D atooid(PQgetvalue(res, j, i_oid)); AssignDumpId(&indxinfo[j].dobj); indxinfo[j].dobj.name =3D pg_strdup(PQgetvalue(res, j, i_indexname)); - indxinfo[j].dobj.namespace =3D tbinfo->dobj.namespace; + indxinfo[j].dobj.namespaceinfo =3D tbinfo->dobj.namespaceinfo; indxinfo[j].indextable =3D tbinfo; indxinfo[j].indexdef =3D pg_strdup(PQgetvalue(res, j, i_indexdef)); indxinfo[j].indnkeys =3D atoi(PQgetvalue(res, j, i_indnkeys)); @@ -6476,7 +6476,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int nu= mTables) constrinfo[j].dobj.catId.oid =3D atooid(PQgetvalue(res, j, i_conoid)); AssignDumpId(&constrinfo[j].dobj); constrinfo[j].dobj.name =3D pg_strdup(PQgetvalue(res, j, i_conname)); - constrinfo[j].dobj.namespace =3D tbinfo->dobj.namespace; + constrinfo[j].dobj.namespaceinfo =3D tbinfo->dobj.namespaceinfo; constrinfo[j].contable =3D tbinfo; constrinfo[j].condomain =3D NULL; constrinfo[j].contype =3D contype; @@ -6542,14 +6542,14 @@ getConstraints(Archive *fout, TableInfo tblinfo[], = int numTables) =20 if (g_verbose) write_msg(NULL, "reading foreign key constraints for table \"%s.%s\"\n", - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, tbinfo->dobj.name); =20 /* * select table schema to ensure constraint expr is qualified if * needed */ - selectSourceSchema(fout, tbinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tbinfo->dobj.namespaceinfo->dobj.name); =20 resetPQExpBuffer(query); appendPQExpBuffer(query, @@ -6578,7 +6578,7 @@ getConstraints(Archive *fout, TableInfo tblinfo[], in= t numTables) constrinfo[j].dobj.catId.oid =3D atooid(PQgetvalue(res, j, i_conoid)); AssignDumpId(&constrinfo[j].dobj); constrinfo[j].dobj.name =3D pg_strdup(PQgetvalue(res, j, i_conname)); - constrinfo[j].dobj.namespace =3D tbinfo->dobj.namespace; + constrinfo[j].dobj.namespaceinfo =3D tbinfo->dobj.namespaceinfo; constrinfo[j].contable =3D tbinfo; constrinfo[j].condomain =3D NULL; constrinfo[j].contype =3D 'f'; @@ -6619,7 +6619,7 @@ getDomainConstraints(Archive *fout, TypeInfo *tyinfo) * select appropriate schema to ensure names in constraint are properly * qualified */ - selectSourceSchema(fout, tyinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tyinfo->dobj.namespaceinfo->dobj.name); =20 query =3D createPQExpBuffer(); =20 @@ -6664,7 +6664,7 @@ getDomainConstraints(Archive *fout, TypeInfo *tyinfo) constrinfo[i].dobj.catId.oid =3D atooid(PQgetvalue(res, i, i_oid)); AssignDumpId(&constrinfo[i].dobj); constrinfo[i].dobj.name =3D pg_strdup(PQgetvalue(res, i, i_conname)); - constrinfo[i].dobj.namespace =3D tyinfo->dobj.namespace; + constrinfo[i].dobj.namespaceinfo =3D tyinfo->dobj.namespaceinfo; constrinfo[i].contable =3D NULL; constrinfo[i].condomain =3D tyinfo; constrinfo[i].contype =3D 'c'; @@ -6767,7 +6767,7 @@ getRules(Archive *fout, int *numRules) if (ruleinfo[i].ruletable =3D=3D NULL) exit_horribly(NULL, "failed sanity check, parent table with OID %u of p= g_rewrite entry with OID %u not found\n", ruletableoid, ruleinfo[i].dobj.catId.oid); - ruleinfo[i].dobj.namespace =3D ruleinfo[i].ruletable->dobj.namespace; + ruleinfo[i].dobj.namespaceinfo =3D ruleinfo[i].ruletable->dobj.namespace= info; ruleinfo[i].dobj.dump =3D ruleinfo[i].ruletable->dobj.dump; ruleinfo[i].ev_type =3D *(PQgetvalue(res, i, i_ev_type)); ruleinfo[i].is_instead =3D *(PQgetvalue(res, i, i_is_instead)) =3D=3D 't= '; @@ -6850,13 +6850,13 @@ getTriggers(Archive *fout, TableInfo tblinfo[], int= numTables) =20 if (g_verbose) write_msg(NULL, "reading triggers for table \"%s.%s\"\n", - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, tbinfo->dobj.name); =20 /* * select table schema to ensure regproc name is qualified if needed */ - selectSourceSchema(fout, tbinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tbinfo->dobj.namespaceinfo->dobj.name); =20 resetPQExpBuffer(query); if (fout->remoteVersion >=3D 90000) @@ -6949,7 +6949,7 @@ getTriggers(Archive *fout, TableInfo tblinfo[], int n= umTables) tginfo[j].dobj.catId.oid =3D atooid(PQgetvalue(res, j, i_oid)); AssignDumpId(&tginfo[j].dobj); tginfo[j].dobj.name =3D pg_strdup(PQgetvalue(res, j, i_tgname)); - tginfo[j].dobj.namespace =3D tbinfo->dobj.namespace; + tginfo[j].dobj.namespaceinfo =3D tbinfo->dobj.namespaceinfo; tginfo[j].tgtable =3D tbinfo; tginfo[j].tgenabled =3D *(PQgetvalue(res, j, i_tgenabled)); if (i_tgdef >=3D 0) @@ -7592,7 +7592,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int = numTables) * Make sure we are in proper schema for this table; this allows * correct retrieval of formatted type names and default exprs */ - selectSourceSchema(fout, tbinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tbinfo->dobj.namespaceinfo->dobj.name); =20 /* find all the user attributes and their types */ =20 @@ -7602,7 +7602,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int = numTables) */ if (g_verbose) write_msg(NULL, "finding the columns and types of table \"%s.%s\"\n", - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, tbinfo->dobj.name); =20 resetPQExpBuffer(q); @@ -7772,7 +7772,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int = numTables) =20 if (g_verbose) write_msg(NULL, "finding default expressions of table \"%s.%s\"\n", - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, tbinfo->dobj.name); =20 printfPQExpBuffer(q, "SELECT tableoid, oid, adnum, " @@ -7813,7 +7813,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int = numTables) attrdefs[j].adef_expr =3D pg_strdup(PQgetvalue(res, j, 3)); =20 attrdefs[j].dobj.name =3D pg_strdup(tbinfo->dobj.name); - attrdefs[j].dobj.namespace =3D tbinfo->dobj.namespace; + attrdefs[j].dobj.namespaceinfo =3D tbinfo->dobj.namespaceinfo; =20 attrdefs[j].dobj.dump =3D tbinfo->dobj.dump; =20 @@ -7861,7 +7861,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int = numTables) =20 if (g_verbose) write_msg(NULL, "finding check constraints for table \"%s.%s\"\n", - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, tbinfo->dobj.name); =20 resetPQExpBuffer(q); @@ -7929,7 +7929,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int = numTables) constrs[j].dobj.catId.oid =3D atooid(PQgetvalue(res, j, 1)); AssignDumpId(&constrs[j].dobj); constrs[j].dobj.name =3D pg_strdup(PQgetvalue(res, j, 2)); - constrs[j].dobj.namespace =3D tbinfo->dobj.namespace; + constrs[j].dobj.namespaceinfo =3D tbinfo->dobj.namespaceinfo; constrs[j].contable =3D tbinfo; constrs[j].condomain =3D NULL; constrs[j].contype =3D 'c'; @@ -8069,7 +8069,7 @@ getTSParsers(Archive *fout, int *numTSParsers) prsinfo[i].dobj.catId.oid =3D atooid(PQgetvalue(res, i, i_oid)); AssignDumpId(&prsinfo[i].dobj); prsinfo[i].dobj.name =3D pg_strdup(PQgetvalue(res, i, i_prsname)); - prsinfo[i].dobj.namespace =3D + prsinfo[i].dobj.namespaceinfo =3D findNamespace(fout, atooid(PQgetvalue(res, i, i_prsnamespace))); prsinfo[i].prsstart =3D atooid(PQgetvalue(res, i, i_prsstart)); @@ -8155,7 +8155,7 @@ getTSDictionaries(Archive *fout, int *numTSDicts) dictinfo[i].dobj.catId.oid =3D atooid(PQgetvalue(res, i, i_oid)); AssignDumpId(&dictinfo[i].dobj); dictinfo[i].dobj.name =3D pg_strdup(PQgetvalue(res, i, i_dictname)); - dictinfo[i].dobj.namespace =3D + dictinfo[i].dobj.namespaceinfo =3D findNamespace(fout, atooid(PQgetvalue(res, i, i_dictnamespace))); dictinfo[i].rolname =3D pg_strdup(PQgetvalue(res, i, i_rolname)); @@ -8238,7 +8238,7 @@ getTSTemplates(Archive *fout, int *numTSTemplates) tmplinfo[i].dobj.catId.oid =3D atooid(PQgetvalue(res, i, i_oid)); AssignDumpId(&tmplinfo[i].dobj); tmplinfo[i].dobj.name =3D pg_strdup(PQgetvalue(res, i, i_tmplname)); - tmplinfo[i].dobj.namespace =3D + tmplinfo[i].dobj.namespaceinfo =3D findNamespace(fout, atooid(PQgetvalue(res, i, i_tmplnamespace))); tmplinfo[i].tmplinit =3D atooid(PQgetvalue(res, i, i_tmplinit)); @@ -8318,7 +8318,7 @@ getTSConfigurations(Archive *fout, int *numTSConfigs) cfginfo[i].dobj.catId.oid =3D atooid(PQgetvalue(res, i, i_oid)); AssignDumpId(&cfginfo[i].dobj); cfginfo[i].dobj.name =3D pg_strdup(PQgetvalue(res, i, i_cfgname)); - cfginfo[i].dobj.namespace =3D + cfginfo[i].dobj.namespaceinfo =3D findNamespace(fout, atooid(PQgetvalue(res, i, i_cfgnamespace))); cfginfo[i].rolname =3D pg_strdup(PQgetvalue(res, i, i_rolname)); @@ -8480,7 +8480,7 @@ getForeignDataWrappers(Archive *fout, int *numForeign= DataWrappers) fdwinfo[i].dobj.catId.oid =3D atooid(PQgetvalue(res, i, i_oid)); AssignDumpId(&fdwinfo[i].dobj); fdwinfo[i].dobj.name =3D pg_strdup(PQgetvalue(res, i, i_fdwname)); - fdwinfo[i].dobj.namespace =3D NULL; + fdwinfo[i].dobj.namespaceinfo =3D NULL; fdwinfo[i].rolname =3D pg_strdup(PQgetvalue(res, i, i_rolname)); fdwinfo[i].fdwhandler =3D pg_strdup(PQgetvalue(res, i, i_fdwhandler)); fdwinfo[i].fdwvalidator =3D pg_strdup(PQgetvalue(res, i, i_fdwvalidator)= ); @@ -8632,7 +8632,7 @@ getForeignServers(Archive *fout, int *numForeignServe= rs) srvinfo[i].dobj.catId.oid =3D atooid(PQgetvalue(res, i, i_oid)); AssignDumpId(&srvinfo[i].dobj); srvinfo[i].dobj.name =3D pg_strdup(PQgetvalue(res, i, i_srvname)); - srvinfo[i].dobj.namespace =3D NULL; + srvinfo[i].dobj.namespaceinfo =3D NULL; srvinfo[i].rolname =3D pg_strdup(PQgetvalue(res, i, i_rolname)); srvinfo[i].srvfdw =3D atooid(PQgetvalue(res, i, i_srvfdw)); srvinfo[i].srvtype =3D pg_strdup(PQgetvalue(res, i, i_srvtype)); @@ -8771,9 +8771,9 @@ getDefaultACLs(Archive *fout, int *numDefaultACLs) daclinfo[i].dobj.name =3D pg_strdup(PQgetvalue(res, i, i_defaclobjtype)); =20 if (nspid !=3D InvalidOid) - daclinfo[i].dobj.namespace =3D findNamespace(fout, nspid); + daclinfo[i].dobj.namespaceinfo =3D findNamespace(fout, nspid); else - daclinfo[i].dobj.namespace =3D NULL; + daclinfo[i].dobj.namespaceinfo =3D NULL; =20 daclinfo[i].defaclrole =3D pg_strdup(PQgetvalue(res, i, i_defaclrole)); daclinfo[i].defaclobjtype =3D *(PQgetvalue(res, i, i_defaclobjtype)); @@ -8813,7 +8813,7 @@ getDefaultACLs(Archive *fout, int *numDefaultACLs) */ static void dumpComment(Archive *fout, const char *target, - const char *namespace, const char *owner, + const char *nspname, const char *owner, CatalogId catalogId, int subid, DumpId dumpId) { DumpOptions *dopt =3D fout->dopt; @@ -8860,7 +8860,7 @@ dumpComment(Archive *fout, const char *target, * post-data. */ ArchiveEntry(fout, nilCatalogId, createDumpId(), - target, namespace, NULL, owner, + target, nspname, NULL, owner, false, "COMMENT", SECTION_NONE, query->data, "", NULL, &(dumpId), 1, @@ -8921,7 +8921,7 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo, =20 ArchiveEntry(fout, nilCatalogId, createDumpId(), target->data, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, NULL, tbinfo->rolname, false, "COMMENT", SECTION_NONE, query->data, "", NULL, @@ -8942,7 +8942,7 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo, =20 ArchiveEntry(fout, nilCatalogId, createDumpId(), target->data, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, NULL, tbinfo->rolname, false, "COMMENT", SECTION_NONE, query->data, "", NULL, @@ -9349,7 +9349,7 @@ dumpExtension(Archive *fout, ExtensionInfo *extinfo) * selectDumpableExtension. */ appendPQExpBuffer(q, "CREATE EXTENSION IF NOT EXISTS %s WITH SCHEMA %s;\= n", - qextname, fmtId(extinfo->namespace)); + qextname, fmtId(extinfo->extschema)); } else { @@ -9371,7 +9371,7 @@ dumpExtension(Archive *fout, ExtensionInfo *extinfo) "SELECT pg_catalog.binary_upgrade_create_empty_extension("); appendStringLiteralAH(q, extinfo->dobj.name, fout); appendPQExpBufferStr(q, ", "); - appendStringLiteralAH(q, extinfo->namespace, fout); + appendStringLiteralAH(q, extinfo->extschema, fout); appendPQExpBufferStr(q, ", "); appendPQExpBuffer(q, "%s, ", extinfo->relocatable ? "true" : "false"); appendStringLiteralAH(q, extinfo->extversion, fout); @@ -9518,7 +9518,7 @@ dumpEnumType(Archive *fout, TypeInfo *tyinfo) * functions are generic and do not get dropped. */ appendPQExpBuffer(delq, "DROP TYPE %s.", - fmtId(tyinfo->dobj.namespace->dobj.name)); + fmtId(tyinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, "%s;\n", qtypname); =20 @@ -9558,7 +9558,7 @@ dumpEnumType(Archive *fout, TypeInfo *tyinfo) "SELECT pg_catalog.binary_upgrade_set_next_pg_enum_oid('%u'::pg_c= atalog.oid);\n", enum_oid); appendPQExpBuffer(q, "ALTER TYPE %s.", - fmtId(tyinfo->dobj.namespace->dobj.name)); + fmtId(tyinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(q, "%s ADD VALUE ", qtypname); appendStringLiteralAH(q, label, fout); @@ -9574,7 +9574,7 @@ dumpEnumType(Archive *fout, TypeInfo *tyinfo) if (tyinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, tyinfo->dobj.name, - tyinfo->dobj.namespace->dobj.name, + tyinfo->dobj.namespaceinfo->dobj.name, NULL, tyinfo->rolname, false, "TYPE", SECTION_PRE_DATA, @@ -9585,18 +9585,18 @@ dumpEnumType(Archive *fout, TypeInfo *tyinfo) /* Dump Type Comments and Security Labels */ if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT) dumpComment(fout, labelq->data, - tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); =20 if (tyinfo->dobj.dump & DUMP_COMPONENT_SECLABEL) dumpSecLabel(fout, labelq->data, - tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); =20 if (tyinfo->dobj.dump & DUMP_COMPONENT_ACL) dumpACL(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, "TYPE", qtypname, NULL, tyinfo->dobj.name, - tyinfo->dobj.namespace->dobj.name, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, tyinfo->typacl, tyinfo->rtypacl, tyinfo->inittypacl, tyinfo->initrtypacl); =20 @@ -9628,7 +9628,7 @@ dumpRangeType(Archive *fout, TypeInfo *tyinfo) * select appropriate schema to ensure names in CREATE are properly * qualified */ - selectSourceSchema(fout, tyinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tyinfo->dobj.namespaceinfo->dobj.name); =20 appendPQExpBuffer(query, "SELECT pg_catalog.format_type(rngsubtype, NULL) AS rngsubtype, " @@ -9655,7 +9655,7 @@ dumpRangeType(Archive *fout, TypeInfo *tyinfo) * functions are generic and do not get dropped. */ appendPQExpBuffer(delq, "DROP TYPE %s.", - fmtId(tyinfo->dobj.namespace->dobj.name)); + fmtId(tyinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, "%s;\n", qtypname); =20 @@ -9690,7 +9690,7 @@ dumpRangeType(Archive *fout, TypeInfo *tyinfo) { /* always schema-qualify, don't try to be smart */ appendPQExpBuffer(q, ",\n collation =3D %s.", - fmtId(coll->dobj.namespace->dobj.name)); + fmtId(coll->dobj.namespaceinfo->dobj.name)); appendPQExpBufferStr(q, fmtId(coll->dobj.name)); } } @@ -9713,7 +9713,7 @@ dumpRangeType(Archive *fout, TypeInfo *tyinfo) if (tyinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, tyinfo->dobj.name, - tyinfo->dobj.namespace->dobj.name, + tyinfo->dobj.namespaceinfo->dobj.name, NULL, tyinfo->rolname, false, "TYPE", SECTION_PRE_DATA, @@ -9724,18 +9724,18 @@ dumpRangeType(Archive *fout, TypeInfo *tyinfo) /* Dump Type Comments and Security Labels */ if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT) dumpComment(fout, labelq->data, - tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); =20 if (tyinfo->dobj.dump & DUMP_COMPONENT_SECLABEL) dumpSecLabel(fout, labelq->data, - tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); =20 if (tyinfo->dobj.dump & DUMP_COMPONENT_ACL) dumpACL(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, "TYPE", qtypname, NULL, tyinfo->dobj.name, - tyinfo->dobj.namespace->dobj.name, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, tyinfo->typacl, tyinfo->rtypacl, tyinfo->inittypacl, tyinfo->initrtypacl); =20 @@ -9770,7 +9770,7 @@ dumpUndefinedType(Archive *fout, TypeInfo *tyinfo) * DROP must be fully qualified in case same name appears in pg_catalog. */ appendPQExpBuffer(delq, "DROP TYPE %s.", - fmtId(tyinfo->dobj.namespace->dobj.name)); + fmtId(tyinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, "%s;\n", qtypname); =20 @@ -9789,7 +9789,7 @@ dumpUndefinedType(Archive *fout, TypeInfo *tyinfo) if (tyinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, tyinfo->dobj.name, - tyinfo->dobj.namespace->dobj.name, + tyinfo->dobj.namespaceinfo->dobj.name, NULL, tyinfo->rolname, false, "TYPE", SECTION_PRE_DATA, @@ -9800,18 +9800,18 @@ dumpUndefinedType(Archive *fout, TypeInfo *tyinfo) /* Dump Type Comments and Security Labels */ if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT) dumpComment(fout, labelq->data, - tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); =20 if (tyinfo->dobj.dump & DUMP_COMPONENT_SECLABEL) dumpSecLabel(fout, labelq->data, - tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); =20 if (tyinfo->dobj.dump & DUMP_COMPONENT_ACL) dumpACL(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, "TYPE", qtypname, NULL, tyinfo->dobj.name, - tyinfo->dobj.namespace->dobj.name, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, tyinfo->typacl, tyinfo->rtypacl, tyinfo->inittypacl, tyinfo->initrtypacl); =20 @@ -9858,7 +9858,7 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo) bool typdefault_is_literal =3D false; =20 /* Set proper schema search path so regproc references list correctly */ - selectSourceSchema(fout, tyinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tyinfo->dobj.namespaceinfo->dobj.name); =20 /* Fetch type-specific details */ if (fout->remoteVersion >=3D 90100) @@ -9976,7 +9976,7 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo) * other way. */ appendPQExpBuffer(delq, "DROP TYPE %s.", - fmtId(tyinfo->dobj.namespace->dobj.name)); + fmtId(tyinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, "%s CASCADE;\n", qtypname); =20 @@ -10022,7 +10022,7 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo) char *elemType; =20 /* reselect schema in case changed by function dump */ - selectSourceSchema(fout, tyinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tyinfo->dobj.namespaceinfo->dobj.name); elemType =3D getFormattedTypeName(fout, tyinfo->typelem, zeroAsOpaque); appendPQExpBuffer(q, ",\n ELEMENT =3D %s", elemType); free(elemType); @@ -10074,7 +10074,7 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo) if (tyinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, tyinfo->dobj.name, - tyinfo->dobj.namespace->dobj.name, + tyinfo->dobj.namespaceinfo->dobj.name, NULL, tyinfo->rolname, false, "TYPE", SECTION_PRE_DATA, @@ -10085,18 +10085,18 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo) /* Dump Type Comments and Security Labels */ if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT) dumpComment(fout, labelq->data, - tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); =20 if (tyinfo->dobj.dump & DUMP_COMPONENT_SECLABEL) dumpSecLabel(fout, labelq->data, - tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); =20 if (tyinfo->dobj.dump & DUMP_COMPONENT_ACL) dumpACL(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, "TYPE", qtypname, NULL, tyinfo->dobj.name, - tyinfo->dobj.namespace->dobj.name, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, tyinfo->typacl, tyinfo->rtypacl, tyinfo->inittypacl, tyinfo->initrtypacl); =20 @@ -10129,7 +10129,7 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo) bool typdefault_is_literal =3D false; =20 /* Set proper schema search path so type references list correctly */ - selectSourceSchema(fout, tyinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tyinfo->dobj.namespaceinfo->dobj.name); =20 /* Fetch domain specific details */ if (fout->remoteVersion >=3D 90100) @@ -10193,7 +10193,7 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo) { /* always schema-qualify, don't try to be smart */ appendPQExpBuffer(q, " COLLATE %s.", - fmtId(coll->dobj.namespace->dobj.name)); + fmtId(coll->dobj.namespaceinfo->dobj.name)); appendPQExpBufferStr(q, fmtId(coll->dobj.name)); } } @@ -10230,7 +10230,7 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo) * DROP must be fully qualified in case same name appears in pg_catalog */ appendPQExpBuffer(delq, "DROP DOMAIN %s.", - fmtId(tyinfo->dobj.namespace->dobj.name)); + fmtId(tyinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, "%s;\n", qtypname); =20 @@ -10242,7 +10242,7 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo) if (tyinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, tyinfo->dobj.name, - tyinfo->dobj.namespace->dobj.name, + tyinfo->dobj.namespaceinfo->dobj.name, NULL, tyinfo->rolname, false, "DOMAIN", SECTION_PRE_DATA, @@ -10253,18 +10253,18 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo) /* Dump Domain Comments and Security Labels */ if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT) dumpComment(fout, labelq->data, - tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); =20 if (tyinfo->dobj.dump & DUMP_COMPONENT_SECLABEL) dumpSecLabel(fout, labelq->data, - tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); =20 if (tyinfo->dobj.dump & DUMP_COMPONENT_ACL) dumpACL(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, "TYPE", qtypname, NULL, tyinfo->dobj.name, - tyinfo->dobj.namespace->dobj.name, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, tyinfo->typacl, tyinfo->rtypacl, tyinfo->inittypacl, tyinfo->initrtypacl); =20 @@ -10281,7 +10281,7 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo) =20 if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT) dumpComment(fout, labelq->data, - tyinfo->dobj.namespace->dobj.name, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, domcheck->dobj.catId, 0, tyinfo->dobj.dumpId); =20 @@ -10321,7 +10321,7 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo) int actual_atts; =20 /* Set proper schema search path so type references list correctly */ - selectSourceSchema(fout, tyinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tyinfo->dobj.namespaceinfo->dobj.name); =20 /* Fetch type specific details */ if (fout->remoteVersion >=3D 90100) @@ -10424,7 +10424,7 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo) { /* always schema-qualify, don't try to be smart */ appendPQExpBuffer(q, " COLLATE %s.", - fmtId(coll->dobj.namespace->dobj.name)); + fmtId(coll->dobj.namespaceinfo->dobj.name)); appendPQExpBufferStr(q, fmtId(coll->dobj.name)); } } @@ -10464,7 +10464,7 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo) * DROP must be fully qualified in case same name appears in pg_catalog */ appendPQExpBuffer(delq, "DROP TYPE %s.", - fmtId(tyinfo->dobj.namespace->dobj.name)); + fmtId(tyinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, "%s;\n", qtypname); =20 @@ -10476,7 +10476,7 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo) if (tyinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, tyinfo->dobj.name, - tyinfo->dobj.namespace->dobj.name, + tyinfo->dobj.namespaceinfo->dobj.name, NULL, tyinfo->rolname, false, "TYPE", SECTION_PRE_DATA, @@ -10488,18 +10488,18 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo) /* Dump Type Comments and Security Labels */ if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT) dumpComment(fout, labelq->data, - tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); =20 if (tyinfo->dobj.dump & DUMP_COMPONENT_SECLABEL) dumpSecLabel(fout, labelq->data, - tyinfo->dobj.namespace->dobj.name, tyinfo->rolname, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, tyinfo->dobj.catId, 0, tyinfo->dobj.dumpId); =20 if (tyinfo->dobj.dump & DUMP_COMPONENT_ACL) dumpACL(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, "TYPE", qtypname, NULL, tyinfo->dobj.name, - tyinfo->dobj.namespace->dobj.name, + tyinfo->dobj.namespaceinfo->dobj.name, tyinfo->rolname, tyinfo->typacl, tyinfo->rtypacl, tyinfo->inittypacl, tyinfo->initrtypacl); =20 @@ -10605,7 +10605,7 @@ dumpCompositeTypeColComments(Archive *fout, TypeInf= o *tyinfo) =20 ArchiveEntry(fout, nilCatalogId, createDumpId(), target->data, - tyinfo->dobj.namespace->dobj.name, + tyinfo->dobj.namespaceinfo->dobj.name, NULL, tyinfo->rolname, false, "COMMENT", SECTION_NONE, query->data, "", NULL, @@ -10659,7 +10659,7 @@ dumpShellType(Archive *fout, ShellTypeInfo *stinfo) if (stinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, stinfo->dobj.catId, stinfo->dobj.dumpId, stinfo->dobj.name, - stinfo->dobj.namespace->dobj.name, + stinfo->dobj.namespaceinfo->dobj.name, NULL, stinfo->baseType->rolname, false, "SHELL TYPE", SECTION_PRE_DATA, @@ -10740,7 +10740,7 @@ dumpProcLang(Archive *fout, ProcLangInfo *plang) * it doesn't really have a schema. */ if (useParams) - lanschema =3D funcInfo->dobj.namespace->dobj.name; + lanschema =3D funcInfo->dobj.namespaceinfo->dobj.name; else lanschema =3D NULL; =20 @@ -10758,18 +10758,18 @@ dumpProcLang(Archive *fout, ProcLangInfo *plang) { appendPQExpBufferStr(defqry, " INLINE "); /* Cope with possibility that inline is in different schema */ - if (inlineInfo->dobj.namespace !=3D funcInfo->dobj.namespace) + if (inlineInfo->dobj.namespaceinfo !=3D funcInfo->dobj.namespaceinfo) appendPQExpBuffer(defqry, "%s.", - fmtId(inlineInfo->dobj.namespace->dobj.name)); + fmtId(inlineInfo->dobj.namespaceinfo->dobj.name)); appendPQExpBufferStr(defqry, fmtId(inlineInfo->dobj.name)); } if (OidIsValid(plang->lanvalidator)) { appendPQExpBufferStr(defqry, " VALIDATOR "); /* Cope with possibility that validator is in different schema */ - if (validatorInfo->dobj.namespace !=3D funcInfo->dobj.namespace) + if (validatorInfo->dobj.namespaceinfo !=3D funcInfo->dobj.namespaceinfo) appendPQExpBuffer(defqry, "%s.", - fmtId(validatorInfo->dobj.namespace->dobj.name)); + fmtId(validatorInfo->dobj.namespaceinfo->dobj.name)); appendPQExpBufferStr(defqry, fmtId(validatorInfo->dobj.name)); } } @@ -11015,7 +11015,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) asPart =3D createPQExpBuffer(); =20 /* Set proper schema search path so type references list correctly */ - selectSourceSchema(fout, finfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, finfo->dobj.namespaceinfo->dobj.name); =20 /* Fetch function-specific details */ if (fout->remoteVersion >=3D 90600) @@ -11289,7 +11289,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) * DROP must be fully qualified in case same name appears in pg_catalog */ appendPQExpBuffer(delqry, "DROP FUNCTION %s.%s;\n", - fmtId(finfo->dobj.namespace->dobj.name), + fmtId(finfo->dobj.namespaceinfo->dobj.name), funcsig); =20 appendPQExpBuffer(q, "CREATE FUNCTION %s ", funcfullsig ? funcfullsig : @@ -11415,7 +11415,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) if (finfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, finfo->dobj.catId, finfo->dobj.dumpId, funcsig_tag, - finfo->dobj.namespace->dobj.name, + finfo->dobj.namespaceinfo->dobj.name, NULL, finfo->rolname, false, "FUNCTION", SECTION_PRE_DATA, @@ -11426,18 +11426,18 @@ dumpFunc(Archive *fout, FuncInfo *finfo) /* Dump Function Comments and Security Labels */ if (finfo->dobj.dump & DUMP_COMPONENT_COMMENT) dumpComment(fout, labelq->data, - finfo->dobj.namespace->dobj.name, finfo->rolname, + finfo->dobj.namespaceinfo->dobj.name, finfo->rolname, finfo->dobj.catId, 0, finfo->dobj.dumpId); =20 if (finfo->dobj.dump & DUMP_COMPONENT_SECLABEL) dumpSecLabel(fout, labelq->data, - finfo->dobj.namespace->dobj.name, finfo->rolname, + finfo->dobj.namespaceinfo->dobj.name, finfo->rolname, finfo->dobj.catId, 0, finfo->dobj.dumpId); =20 if (finfo->dobj.dump & DUMP_COMPONENT_ACL) dumpACL(fout, finfo->dobj.catId, finfo->dobj.dumpId, "FUNCTION", funcsig, NULL, funcsig_tag, - finfo->dobj.namespace->dobj.name, + finfo->dobj.namespaceinfo->dobj.name, finfo->rolname, finfo->proacl, finfo->rproacl, finfo->initproacl, finfo->initrproacl); =20 @@ -11527,7 +11527,7 @@ dumpCast(Archive *fout, CastInfo *cast) * it). */ appendPQExpBuffer(defqry, "WITH FUNCTION %s.%s", - fmtId(funcInfo->dobj.namespace->dobj.name), fsig); + fmtId(funcInfo->dobj.namespaceinfo->dobj.name), fsig); free(fsig); } else @@ -11637,7 +11637,7 @@ dumpTransform(Archive *fout, TransformInfo *transfo= rm) * pg_catalog schema (format_function_signature won't qualify it). */ appendPQExpBuffer(defqry, "FROM SQL WITH FUNCTION %s.%s", - fmtId(fromsqlFuncInfo->dobj.namespace->dobj.name), fsig); + fmtId(fromsqlFuncInfo->dobj.namespaceinfo->dobj.name), fsig); free(fsig); } else @@ -11658,7 +11658,7 @@ dumpTransform(Archive *fout, TransformInfo *transfo= rm) * pg_catalog schema (format_function_signature won't qualify it). */ appendPQExpBuffer(defqry, "TO SQL WITH FUNCTION %s.%s", - fmtId(tosqlFuncInfo->dobj.namespace->dobj.name), fsig); + fmtId(tosqlFuncInfo->dobj.namespaceinfo->dobj.name), fsig); free(fsig); } else @@ -11753,7 +11753,7 @@ dumpOpr(Archive *fout, OprInfo *oprinfo) details =3D createPQExpBuffer(); =20 /* Make sure we are in proper schema so regoperator works correctly */ - selectSourceSchema(fout, oprinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, oprinfo->dobj.namespaceinfo->dobj.name); =20 if (fout->remoteVersion >=3D 80300) { @@ -11881,7 +11881,7 @@ dumpOpr(Archive *fout, OprInfo *oprinfo) * DROP must be fully qualified in case same name appears in pg_catalog */ appendPQExpBuffer(delq, "DROP OPERATOR %s.%s;\n", - fmtId(oprinfo->dobj.namespace->dobj.name), + fmtId(oprinfo->dobj.namespaceinfo->dobj.name), oprid->data); =20 appendPQExpBuffer(q, "CREATE OPERATOR %s (\n%s\n);\n", @@ -11895,7 +11895,7 @@ dumpOpr(Archive *fout, OprInfo *oprinfo) if (oprinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, oprinfo->dobj.catId, oprinfo->dobj.dumpId, oprinfo->dobj.name, - oprinfo->dobj.namespace->dobj.name, + oprinfo->dobj.namespaceinfo->dobj.name, NULL, oprinfo->rolname, false, "OPERATOR", SECTION_PRE_DATA, @@ -11906,7 +11906,7 @@ dumpOpr(Archive *fout, OprInfo *oprinfo) /* Dump Operator Comments */ if (oprinfo->dobj.dump & DUMP_COMPONENT_COMMENT) dumpComment(fout, labelq->data, - oprinfo->dobj.namespace->dobj.name, oprinfo->rolname, + oprinfo->dobj.namespaceinfo->dobj.name, oprinfo->rolname, oprinfo->dobj.catId, 0, oprinfo->dobj.dumpId); =20 PQclear(res); @@ -12161,7 +12161,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) labelq =3D createPQExpBuffer(); =20 /* Make sure we are in proper schema so regoperator works correctly */ - selectSourceSchema(fout, opcinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, opcinfo->dobj.namespaceinfo->dobj.name); =20 /* Get additional fields from the pg_opclass row */ if (fout->remoteVersion >=3D 80300) @@ -12215,7 +12215,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) * DROP must be fully qualified in case same name appears in pg_catalog */ appendPQExpBuffer(delq, "DROP OPERATOR CLASS %s", - fmtId(opcinfo->dobj.namespace->dobj.name)); + fmtId(opcinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, ".%s", fmtId(opcinfo->dobj.name)); appendPQExpBuffer(delq, " USING %s;\n", @@ -12232,7 +12232,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) if (strlen(opcfamilyname) > 0) { appendPQExpBufferStr(q, " FAMILY "); - if (strcmp(opcfamilynsp, opcinfo->dobj.namespace->dobj.name) !=3D 0) + if (strcmp(opcfamilynsp, opcinfo->dobj.namespaceinfo->dobj.name) !=3D 0) appendPQExpBuffer(q, "%s.", fmtId(opcfamilynsp)); appendPQExpBufferStr(q, fmtId(opcfamilyname)); } @@ -12351,7 +12351,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) if (strlen(sortfamily) > 0) { appendPQExpBufferStr(q, " FOR ORDER BY "); - if (strcmp(sortfamilynsp, opcinfo->dobj.namespace->dobj.name) !=3D 0) + if (strcmp(sortfamilynsp, opcinfo->dobj.namespaceinfo->dobj.name) !=3D = 0) appendPQExpBuffer(q, "%s.", fmtId(sortfamilynsp)); appendPQExpBufferStr(q, fmtId(sortfamily)); } @@ -12448,7 +12448,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) if (opcinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, opcinfo->dobj.catId, opcinfo->dobj.dumpId, opcinfo->dobj.name, - opcinfo->dobj.namespace->dobj.name, + opcinfo->dobj.namespaceinfo->dobj.name, NULL, opcinfo->rolname, false, "OPERATOR CLASS", SECTION_PRE_DATA, @@ -12521,7 +12521,7 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo) labelq =3D createPQExpBuffer(); =20 /* Make sure we are in proper schema so regoperator works correctly */ - selectSourceSchema(fout, opfinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, opfinfo->dobj.namespaceinfo->dobj.name); =20 /* * Fetch only those opfamily members that are tied directly to the @@ -12617,7 +12617,7 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo) * DROP must be fully qualified in case same name appears in pg_catalog */ appendPQExpBuffer(delq, "DROP OPERATOR FAMILY %s", - fmtId(opfinfo->dobj.namespace->dobj.name)); + fmtId(opfinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, ".%s", fmtId(opfinfo->dobj.name)); appendPQExpBuffer(delq, " USING %s;\n", @@ -12669,7 +12669,7 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo) if (strlen(sortfamily) > 0) { appendPQExpBufferStr(q, " FOR ORDER BY "); - if (strcmp(sortfamilynsp, opfinfo->dobj.namespace->dobj.name) !=3D 0) + if (strcmp(sortfamilynsp, opfinfo->dobj.namespaceinfo->dobj.name) !=3D= 0) appendPQExpBuffer(q, "%s.", fmtId(sortfamilynsp)); appendPQExpBufferStr(q, fmtId(sortfamily)); } @@ -12721,7 +12721,7 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo) if (opfinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, opfinfo->dobj.catId, opfinfo->dobj.dumpId, opfinfo->dobj.name, - opfinfo->dobj.namespace->dobj.name, + opfinfo->dobj.namespaceinfo->dobj.name, NULL, opfinfo->rolname, false, "OPERATOR FAMILY", SECTION_PRE_DATA, @@ -12772,7 +12772,7 @@ dumpCollation(Archive *fout, CollInfo *collinfo) labelq =3D createPQExpBuffer(); =20 /* Make sure we are in proper schema */ - selectSourceSchema(fout, collinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, collinfo->dobj.namespaceinfo->dobj.name); =20 /* Get collation-specific details */ appendPQExpBuffer(query, "SELECT " @@ -12794,7 +12794,7 @@ dumpCollation(Archive *fout, CollInfo *collinfo) * DROP must be fully qualified in case same name appears in pg_catalog */ appendPQExpBuffer(delq, "DROP COLLATION %s", - fmtId(collinfo->dobj.namespace->dobj.name)); + fmtId(collinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, ".%s;\n", fmtId(collinfo->dobj.name)); =20 @@ -12813,7 +12813,7 @@ dumpCollation(Archive *fout, CollInfo *collinfo) if (collinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, collinfo->dobj.catId, collinfo->dobj.dumpId, collinfo->dobj.name, - collinfo->dobj.namespace->dobj.name, + collinfo->dobj.namespaceinfo->dobj.name, NULL, collinfo->rolname, false, "COLLATION", SECTION_PRE_DATA, @@ -12824,7 +12824,7 @@ dumpCollation(Archive *fout, CollInfo *collinfo) /* Dump Collation Comments */ if (collinfo->dobj.dump & DUMP_COMPONENT_COMMENT) dumpComment(fout, labelq->data, - collinfo->dobj.namespace->dobj.name, collinfo->rolname, + collinfo->dobj.namespaceinfo->dobj.name, collinfo->rolname, collinfo->dobj.catId, 0, collinfo->dobj.dumpId); =20 PQclear(res); @@ -12867,7 +12867,7 @@ dumpConversion(Archive *fout, ConvInfo *convinfo) labelq =3D createPQExpBuffer(); =20 /* Make sure we are in proper schema */ - selectSourceSchema(fout, convinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, convinfo->dobj.namespaceinfo->dobj.name); =20 /* Get conversion-specific details */ appendPQExpBuffer(query, "SELECT " @@ -12894,7 +12894,7 @@ dumpConversion(Archive *fout, ConvInfo *convinfo) * DROP must be fully qualified in case same name appears in pg_catalog */ appendPQExpBuffer(delq, "DROP CONVERSION %s", - fmtId(convinfo->dobj.namespace->dobj.name)); + fmtId(convinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, ".%s;\n", fmtId(convinfo->dobj.name)); =20 @@ -12915,7 +12915,7 @@ dumpConversion(Archive *fout, ConvInfo *convinfo) if (convinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, convinfo->dobj.catId, convinfo->dobj.dumpId, convinfo->dobj.name, - convinfo->dobj.namespace->dobj.name, + convinfo->dobj.namespaceinfo->dobj.name, NULL, convinfo->rolname, false, "CONVERSION", SECTION_PRE_DATA, @@ -12926,7 +12926,7 @@ dumpConversion(Archive *fout, ConvInfo *convinfo) /* Dump Conversion Comments */ if (convinfo->dobj.dump & DUMP_COMPONENT_COMMENT) dumpComment(fout, labelq->data, - convinfo->dobj.namespace->dobj.name, convinfo->rolname, + convinfo->dobj.namespaceinfo->dobj.name, convinfo->rolname, convinfo->dobj.catId, 0, convinfo->dobj.dumpId); =20 PQclear(res); @@ -13047,7 +13047,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) details =3D createPQExpBuffer(); =20 /* Make sure we are in proper schema */ - selectSourceSchema(fout, agginfo->aggfn.dobj.namespace->dobj.name); + selectSourceSchema(fout, agginfo->aggfn.dobj.namespaceinfo->dobj.name); =20 /* Get aggregate-specific details */ if (fout->remoteVersion >=3D 90600) @@ -13314,7 +13314,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) * DROP must be fully qualified in case same name appears in pg_catalog */ appendPQExpBuffer(delq, "DROP AGGREGATE %s.%s;\n", - fmtId(agginfo->aggfn.dobj.namespace->dobj.name), + fmtId(agginfo->aggfn.dobj.namespaceinfo->dobj.name), aggsig); =20 appendPQExpBuffer(q, "CREATE AGGREGATE %s (\n%s\n);\n", @@ -13329,7 +13329,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) ArchiveEntry(fout, agginfo->aggfn.dobj.catId, agginfo->aggfn.dobj.dumpId, aggsig_tag, - agginfo->aggfn.dobj.namespace->dobj.name, + agginfo->aggfn.dobj.namespaceinfo->dobj.name, NULL, agginfo->aggfn.rolname, false, "AGGREGATE", SECTION_PRE_DATA, @@ -13340,13 +13340,13 @@ dumpAgg(Archive *fout, AggInfo *agginfo) /* Dump Aggregate Comments */ if (agginfo->aggfn.dobj.dump & DUMP_COMPONENT_COMMENT) dumpComment(fout, labelq->data, - agginfo->aggfn.dobj.namespace->dobj.name, + agginfo->aggfn.dobj.namespaceinfo->dobj.name, agginfo->aggfn.rolname, agginfo->aggfn.dobj.catId, 0, agginfo->aggfn.dobj.dumpId); =20 if (agginfo->aggfn.dobj.dump & DUMP_COMPONENT_SECLABEL) dumpSecLabel(fout, labelq->data, - agginfo->aggfn.dobj.namespace->dobj.name, + agginfo->aggfn.dobj.namespaceinfo->dobj.name, agginfo->aggfn.rolname, agginfo->aggfn.dobj.catId, 0, agginfo->aggfn.dobj.dumpId); =20 @@ -13365,7 +13365,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) dumpACL(fout, agginfo->aggfn.dobj.catId, agginfo->aggfn.dobj.dumpId, "FUNCTION", aggsig, NULL, aggsig_tag, - agginfo->aggfn.dobj.namespace->dobj.name, + agginfo->aggfn.dobj.namespaceinfo->dobj.name, agginfo->aggfn.rolname, agginfo->aggfn.proacl, agginfo->aggfn.rproacl, agginfo->aggfn.initproacl, agginfo->aggfn.initrproacl); @@ -13405,7 +13405,7 @@ dumpTSParser(Archive *fout, TSParserInfo *prsinfo) labelq =3D createPQExpBuffer(); =20 /* Make sure we are in proper schema */ - selectSourceSchema(fout, prsinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, prsinfo->dobj.namespaceinfo->dobj.name); =20 appendPQExpBuffer(q, "CREATE TEXT SEARCH PARSER %s (\n", fmtId(prsinfo->dobj.name)); @@ -13426,7 +13426,7 @@ dumpTSParser(Archive *fout, TSParserInfo *prsinfo) * DROP must be fully qualified in case same name appears in pg_catalog */ appendPQExpBuffer(delq, "DROP TEXT SEARCH PARSER %s", - fmtId(prsinfo->dobj.namespace->dobj.name)); + fmtId(prsinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, ".%s;\n", fmtId(prsinfo->dobj.name)); =20 @@ -13439,7 +13439,7 @@ dumpTSParser(Archive *fout, TSParserInfo *prsinfo) if (prsinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, prsinfo->dobj.catId, prsinfo->dobj.dumpId, prsinfo->dobj.name, - prsinfo->dobj.namespace->dobj.name, + prsinfo->dobj.namespaceinfo->dobj.name, NULL, "", false, "TEXT SEARCH PARSER", SECTION_PRE_DATA, @@ -13494,13 +13494,13 @@ dumpTSDictionary(Archive *fout, TSDictInfo *dicti= nfo) tmplname =3D PQgetvalue(res, 0, 1); =20 /* Make sure we are in proper schema */ - selectSourceSchema(fout, dictinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, dictinfo->dobj.namespaceinfo->dobj.name); =20 appendPQExpBuffer(q, "CREATE TEXT SEARCH DICTIONARY %s (\n", fmtId(dictinfo->dobj.name)); =20 appendPQExpBufferStr(q, " TEMPLATE =3D "); - if (strcmp(nspname, dictinfo->dobj.namespace->dobj.name) !=3D 0) + if (strcmp(nspname, dictinfo->dobj.namespaceinfo->dobj.name) !=3D 0) appendPQExpBuffer(q, "%s.", fmtId(nspname)); appendPQExpBufferStr(q, fmtId(tmplname)); =20 @@ -13516,7 +13516,7 @@ dumpTSDictionary(Archive *fout, TSDictInfo *dictinf= o) * DROP must be fully qualified in case same name appears in pg_catalog */ appendPQExpBuffer(delq, "DROP TEXT SEARCH DICTIONARY %s", - fmtId(dictinfo->dobj.namespace->dobj.name)); + fmtId(dictinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, ".%s;\n", fmtId(dictinfo->dobj.name)); =20 @@ -13529,7 +13529,7 @@ dumpTSDictionary(Archive *fout, TSDictInfo *dictinf= o) if (dictinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, dictinfo->dobj.catId, dictinfo->dobj.dumpId, dictinfo->dobj.name, - dictinfo->dobj.namespace->dobj.name, + dictinfo->dobj.namespaceinfo->dobj.name, NULL, dictinfo->rolname, false, "TEXT SEARCH DICTIONARY", SECTION_PRE_DATA, @@ -13570,7 +13570,7 @@ dumpTSTemplate(Archive *fout, TSTemplateInfo *tmpli= nfo) labelq =3D createPQExpBuffer(); =20 /* Make sure we are in proper schema */ - selectSourceSchema(fout, tmplinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tmplinfo->dobj.namespaceinfo->dobj.name); =20 appendPQExpBuffer(q, "CREATE TEXT SEARCH TEMPLATE %s (\n", fmtId(tmplinfo->dobj.name)); @@ -13585,7 +13585,7 @@ dumpTSTemplate(Archive *fout, TSTemplateInfo *tmpli= nfo) * DROP must be fully qualified in case same name appears in pg_catalog */ appendPQExpBuffer(delq, "DROP TEXT SEARCH TEMPLATE %s", - fmtId(tmplinfo->dobj.namespace->dobj.name)); + fmtId(tmplinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, ".%s;\n", fmtId(tmplinfo->dobj.name)); =20 @@ -13598,7 +13598,7 @@ dumpTSTemplate(Archive *fout, TSTemplateInfo *tmpli= nfo) if (tmplinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, tmplinfo->dobj.catId, tmplinfo->dobj.dumpId, tmplinfo->dobj.name, - tmplinfo->dobj.namespace->dobj.name, + tmplinfo->dobj.namespaceinfo->dobj.name, NULL, "", false, "TEXT SEARCH TEMPLATE", SECTION_PRE_DATA, @@ -13657,13 +13657,13 @@ dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo) prsname =3D PQgetvalue(res, 0, 1); =20 /* Make sure we are in proper schema */ - selectSourceSchema(fout, cfginfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, cfginfo->dobj.namespaceinfo->dobj.name); =20 appendPQExpBuffer(q, "CREATE TEXT SEARCH CONFIGURATION %s (\n", fmtId(cfginfo->dobj.name)); =20 appendPQExpBufferStr(q, " PARSER =3D "); - if (strcmp(nspname, cfginfo->dobj.namespace->dobj.name) !=3D 0) + if (strcmp(nspname, cfginfo->dobj.namespaceinfo->dobj.name) !=3D 0) appendPQExpBuffer(q, "%s.", fmtId(nspname)); appendPQExpBuffer(q, "%s );\n", fmtId(prsname)); =20 @@ -13716,7 +13716,7 @@ dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo) * DROP must be fully qualified in case same name appears in pg_catalog */ appendPQExpBuffer(delq, "DROP TEXT SEARCH CONFIGURATION %s", - fmtId(cfginfo->dobj.namespace->dobj.name)); + fmtId(cfginfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, ".%s;\n", fmtId(cfginfo->dobj.name)); =20 @@ -13729,7 +13729,7 @@ dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo) if (cfginfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, cfginfo->dobj.catId, cfginfo->dobj.dumpId, cfginfo->dobj.name, - cfginfo->dobj.namespace->dobj.name, + cfginfo->dobj.namespaceinfo->dobj.name, NULL, cfginfo->rolname, false, "TEXT SEARCH CONFIGURATION", SECTION_PRE_DATA, @@ -13942,7 +13942,7 @@ dumpForeignServer(Archive *fout, ForeignServerInfo = *srvinfo) */ static void dumpUserMappings(Archive *fout, - const char *servername, const char *namespace, + const char *servername, const char *nspname, const char *owner, CatalogId catalogId, DumpId dumpId) { @@ -14017,7 +14017,7 @@ dumpUserMappings(Archive *fout, =20 ArchiveEntry(fout, nilCatalogId, createDumpId(), tag->data, - namespace, + nspname, NULL, owner, false, "USER MAPPING", SECTION_PRE_DATA, @@ -14078,8 +14078,8 @@ dumpDefaultACL(Archive *fout, DefaultACLInfo *dacli= nfo) =20 /* build the actual command(s) for this tuple */ if (!buildDefaultACLCommands(type, - daclinfo->dobj.namespace !=3D NULL ? - daclinfo->dobj.namespace->dobj.name : NULL, + daclinfo->dobj.namespaceinfo !=3D NULL ? + daclinfo->dobj.namespaceinfo->dobj.name : NULL, daclinfo->defaclacl, daclinfo->rdefaclacl, daclinfo->initdefaclacl, @@ -14093,7 +14093,7 @@ dumpDefaultACL(Archive *fout, DefaultACLInfo *dacli= nfo) if (daclinfo->dobj.dump & DUMP_COMPONENT_ACL) ArchiveEntry(fout, daclinfo->dobj.catId, daclinfo->dobj.dumpId, tag->data, - daclinfo->dobj.namespace ? daclinfo->dobj.namespace->dobj.name : NULL, + daclinfo->dobj.namespaceinfo ? daclinfo->dobj.namespaceinfo->dobj.name := NULL, NULL, daclinfo->defaclrole, false, "DEFAULT ACL", SECTION_POST_DATA, @@ -14202,7 +14202,7 @@ dumpACL(Archive *fout, CatalogId objCatId, DumpId o= bjDumpId, */ static void dumpSecLabel(Archive *fout, const char *target, - const char *namespace, const char *owner, + const char *nspname, const char *owner, CatalogId catalogId, int subid, DumpId dumpId) { DumpOptions *dopt =3D fout->dopt; @@ -14250,7 +14250,7 @@ dumpSecLabel(Archive *fout, const char *target, if (query->len > 0) { ArchiveEntry(fout, nilCatalogId, createDumpId(), - target, namespace, NULL, owner, + target, nspname, NULL, owner, false, "SECURITY LABEL", SECTION_NONE, query->data, "", NULL, &(dumpId), 1, @@ -14328,7 +14328,7 @@ dumpTableSecLabel(Archive *fout, TableInfo *tbinfo,= const char *reltypename) fmtId(tbinfo->dobj.name)); ArchiveEntry(fout, nilCatalogId, createDumpId(), target->data, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, NULL, tbinfo->rolname, false, "SECURITY LABEL", SECTION_NONE, query->data, "", NULL, @@ -14512,7 +14512,7 @@ dumpTable(Archive *fout, TableInfo *tbinfo) (tbinfo->relkind =3D=3D RELKIND_SEQUENCE) ? "SEQUENCE" : "TABLE", namecopy, NULL, tbinfo->dobj.name, - tbinfo->dobj.namespace->dobj.name, tbinfo->rolname, + tbinfo->dobj.namespaceinfo->dobj.name, tbinfo->rolname, tbinfo->relacl, tbinfo->rrelacl, tbinfo->initrelacl, tbinfo->initrrelacl); =20 @@ -14602,7 +14602,7 @@ dumpTable(Archive *fout, TableInfo *tbinfo) /* Column's GRANT type is always TABLE */ dumpACL(fout, tbinfo->dobj.catId, tbinfo->dobj.dumpId, "TABLE", namecopy, attnamecopy, acltag, - tbinfo->dobj.namespace->dobj.name, tbinfo->rolname, + tbinfo->dobj.namespaceinfo->dobj.name, tbinfo->rolname, attacl, rattacl, initattacl, initrattacl); free(attnamecopy); free(acltag); @@ -14700,7 +14700,7 @@ createDummyViewAsClause(Archive *fout, TableInfo *t= binfo) { /* always schema-qualify, don't try to be smart */ appendPQExpBuffer(result, " COLLATE %s.", - fmtId(coll->dobj.namespace->dobj.name)); + fmtId(coll->dobj.namespaceinfo->dobj.name)); appendPQExpBufferStr(result, fmtId(coll->dobj.name)); } } @@ -14733,7 +14733,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) k; =20 /* Make sure we are in proper schema */ - selectSourceSchema(fout, tbinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tbinfo->dobj.namespaceinfo->dobj.name); =20 if (dopt->binary_upgrade) binary_upgrade_set_type_oids_by_rel_oid(fout, q, @@ -14755,7 +14755,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) * pg_catalog */ appendPQExpBuffer(delq, "DROP VIEW %s.", - fmtId(tbinfo->dobj.namespace->dobj.name)); + fmtId(tbinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, "%s;\n", fmtId(tbinfo->dobj.name)); =20 @@ -14841,7 +14841,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) * pg_catalog */ appendPQExpBuffer(delq, "DROP %s %s.", reltypename, - fmtId(tbinfo->dobj.namespace->dobj.name)); + fmtId(tbinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, "%s;\n", fmtId(tbinfo->dobj.name)); =20 @@ -14870,9 +14870,9 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) TableInfo *parentRel =3D tbinfo->partitionOf; =20 appendPQExpBuffer(q, " PARTITION OF "); - if (parentRel->dobj.namespace !=3D tbinfo->dobj.namespace) + if (parentRel->dobj.namespaceinfo !=3D tbinfo->dobj.namespaceinfo) appendPQExpBuffer(q, "%s.", - fmtId(parentRel->dobj.namespace->dobj.name)); + fmtId(parentRel->dobj.namespaceinfo->dobj.name)); appendPQExpBufferStr(q, fmtId(parentRel->dobj.name)); } =20 @@ -14958,7 +14958,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) { /* always schema-qualify, don't try to be smart */ appendPQExpBuffer(q, " COLLATE %s.", - fmtId(coll->dobj.namespace->dobj.name)); + fmtId(coll->dobj.namespaceinfo->dobj.name)); appendPQExpBufferStr(q, fmtId(coll->dobj.name)); } } @@ -15021,9 +15021,9 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) =20 if (k > 0) appendPQExpBufferStr(q, ", "); - if (parentRel->dobj.namespace !=3D tbinfo->dobj.namespace) + if (parentRel->dobj.namespaceinfo !=3D tbinfo->dobj.namespaceinfo) appendPQExpBuffer(q, "%s.", - fmtId(parentRel->dobj.namespace->dobj.name)); + fmtId(parentRel->dobj.namespaceinfo->dobj.name)); appendPQExpBufferStr(q, fmtId(parentRel->dobj.name)); } appendPQExpBufferChar(q, ')'); @@ -15165,9 +15165,9 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) =20 appendPQExpBuffer(q, "ALTER TABLE ONLY %s INHERIT ", fmtId(tbinfo->dobj.name)); - if (parentRel->dobj.namespace !=3D tbinfo->dobj.namespace) + if (parentRel->dobj.namespaceinfo !=3D tbinfo->dobj.namespaceinfo) appendPQExpBuffer(q, "%s.", - fmtId(parentRel->dobj.namespace->dobj.name)); + fmtId(parentRel->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(q, "%s;\n", fmtId(parentRel->dobj.name)); } @@ -15373,7 +15373,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) if (tbinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, tbinfo->dobj.catId, tbinfo->dobj.dumpId, tbinfo->dobj.name, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, (tbinfo->relkind =3D=3D RELKIND_VIEW) ? NULL : tbinfo->reltablespace, tbinfo->rolname, (strcmp(reltypename, "TABLE") =3D=3D 0) ? tbinfo->hasoids : false, @@ -15444,7 +15444,7 @@ dumpAttrDef(Archive *fout, AttrDefInfo *adinfo) * DROP must be fully qualified in case same name appears in pg_catalog */ appendPQExpBuffer(delq, "ALTER TABLE %s.", - fmtId(tbinfo->dobj.namespace->dobj.name)); + fmtId(tbinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, "%s ", fmtId(tbinfo->dobj.name)); appendPQExpBuffer(delq, "ALTER COLUMN %s DROP DEFAULT;\n", @@ -15455,7 +15455,7 @@ dumpAttrDef(Archive *fout, AttrDefInfo *adinfo) if (adinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, adinfo->dobj.catId, adinfo->dobj.dumpId, tag, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, NULL, tbinfo->rolname, false, "DEFAULT", SECTION_PRE_DATA, @@ -15565,14 +15565,14 @@ dumpIndex(Archive *fout, IndxInfo *indxinfo) * pg_catalog */ appendPQExpBuffer(delq, "DROP INDEX %s.", - fmtId(tbinfo->dobj.namespace->dobj.name)); + fmtId(tbinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, "%s;\n", fmtId(indxinfo->dobj.name)); =20 if (indxinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, indxinfo->dobj.catId, indxinfo->dobj.dumpId, indxinfo->dobj.name, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, indxinfo->tablespace, tbinfo->rolname, false, "INDEX", SECTION_POST_DATA, @@ -15584,7 +15584,7 @@ dumpIndex(Archive *fout, IndxInfo *indxinfo) /* Dump Index Comments */ if (indxinfo->dobj.dump & DUMP_COMPONENT_COMMENT) dumpComment(fout, labelq->data, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, tbinfo->rolname, indxinfo->dobj.catId, 0, is_constraint ? indxinfo->indexconstraint : @@ -15694,7 +15694,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *conin= fo) * pg_catalog */ appendPQExpBuffer(delq, "ALTER TABLE ONLY %s.", - fmtId(tbinfo->dobj.namespace->dobj.name)); + fmtId(tbinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, "%s ", fmtId(tbinfo->dobj.name)); appendPQExpBuffer(delq, "DROP CONSTRAINT %s;\n", @@ -15705,7 +15705,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *conin= fo) if (coninfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, coninfo->dobj.catId, coninfo->dobj.dumpId, tag, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, indxinfo->tablespace, tbinfo->rolname, false, "CONSTRAINT", SECTION_POST_DATA, @@ -15730,7 +15730,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *conin= fo) * pg_catalog */ appendPQExpBuffer(delq, "ALTER TABLE ONLY %s.", - fmtId(tbinfo->dobj.namespace->dobj.name)); + fmtId(tbinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, "%s ", fmtId(tbinfo->dobj.name)); appendPQExpBuffer(delq, "DROP CONSTRAINT %s;\n", @@ -15741,7 +15741,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *conin= fo) if (coninfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, coninfo->dobj.catId, coninfo->dobj.dumpId, tag, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, NULL, tbinfo->rolname, false, "FK CONSTRAINT", SECTION_POST_DATA, @@ -15768,7 +15768,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *conin= fo) * pg_catalog */ appendPQExpBuffer(delq, "ALTER TABLE %s.", - fmtId(tbinfo->dobj.namespace->dobj.name)); + fmtId(tbinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, "%s ", fmtId(tbinfo->dobj.name)); appendPQExpBuffer(delq, "DROP CONSTRAINT %s;\n", @@ -15779,7 +15779,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *conin= fo) if (coninfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, coninfo->dobj.catId, coninfo->dobj.dumpId, tag, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, NULL, tbinfo->rolname, false, "CHECK CONSTRAINT", SECTION_POST_DATA, @@ -15807,7 +15807,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *conin= fo) * pg_catalog */ appendPQExpBuffer(delq, "ALTER DOMAIN %s.", - fmtId(tyinfo->dobj.namespace->dobj.name)); + fmtId(tyinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delq, "%s ", fmtId(tyinfo->dobj.name)); appendPQExpBuffer(delq, "DROP CONSTRAINT %s;\n", @@ -15818,7 +15818,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *conin= fo) if (coninfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, coninfo->dobj.catId, coninfo->dobj.dumpId, tag, - tyinfo->dobj.namespace->dobj.name, + tyinfo->dobj.namespaceinfo->dobj.name, NULL, tyinfo->rolname, false, "CHECK CONSTRAINT", SECTION_POST_DATA, @@ -15863,7 +15863,7 @@ dumpTableConstraintComment(Archive *fout, Constrain= tInfo *coninfo) =20 if (coninfo->dobj.dump & DUMP_COMPONENT_COMMENT) dumpComment(fout, labelq->data, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, tbinfo->rolname, coninfo->dobj.catId, 0, coninfo->separate ? coninfo->dobj.dumpId : tbinfo->dobj.dumpId); @@ -15942,7 +15942,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) */ =20 /* Make sure we are in proper schema */ - selectSourceSchema(fout, tbinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tbinfo->dobj.namespaceinfo->dobj.name); =20 appendPQExpBuffer(query, "SELECT 'bigint'::name AS sequence_type, " @@ -15953,7 +15953,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) else { /* Make sure we are in proper schema */ - selectSourceSchema(fout, tbinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tbinfo->dobj.namespaceinfo->dobj.name); =20 appendPQExpBuffer(query, "SELECT 'bigint'::name AS sequence_type, " @@ -16020,7 +16020,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) * DROP must be fully qualified in case same name appears in pg_catalog */ appendPQExpBuffer(delqry, "DROP SEQUENCE %s.", - fmtId(tbinfo->dobj.namespace->dobj.name)); + fmtId(tbinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delqry, "%s;\n", fmtId(tbinfo->dobj.name)); =20 @@ -16073,7 +16073,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) if (tbinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, tbinfo->dobj.catId, tbinfo->dobj.dumpId, tbinfo->dobj.name, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, NULL, tbinfo->rolname, false, "SEQUENCE", SECTION_PRE_DATA, @@ -16114,7 +16114,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) if (tbinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, nilCatalogId, createDumpId(), tbinfo->dobj.name, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, NULL, tbinfo->rolname, false, "SEQUENCE OWNED BY", SECTION_PRE_DATA, @@ -16127,12 +16127,12 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) /* Dump Sequence Comments and Security Labels */ if (tbinfo->dobj.dump & DUMP_COMPONENT_COMMENT) dumpComment(fout, labelq->data, - tbinfo->dobj.namespace->dobj.name, tbinfo->rolname, + tbinfo->dobj.namespaceinfo->dobj.name, tbinfo->rolname, tbinfo->dobj.catId, 0, tbinfo->dobj.dumpId); =20 if (tbinfo->dobj.dump & DUMP_COMPONENT_SECLABEL) dumpSecLabel(fout, labelq->data, - tbinfo->dobj.namespace->dobj.name, tbinfo->rolname, + tbinfo->dobj.namespaceinfo->dobj.name, tbinfo->rolname, tbinfo->dobj.catId, 0, tbinfo->dobj.dumpId); =20 PQclear(res); @@ -16156,7 +16156,7 @@ dumpSequenceData(Archive *fout, TableDataInfo *tdin= fo) PQExpBuffer query =3D createPQExpBuffer(); =20 /* Make sure we are in proper schema */ - selectSourceSchema(fout, tbinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tbinfo->dobj.namespaceinfo->dobj.name); =20 appendPQExpBuffer(query, "SELECT last_value, is_called FROM %s", @@ -16185,7 +16185,7 @@ dumpSequenceData(Archive *fout, TableDataInfo *tdin= fo) if (tdinfo->dobj.dump & DUMP_COMPONENT_DATA) ArchiveEntry(fout, nilCatalogId, createDumpId(), tbinfo->dobj.name, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, NULL, tbinfo->rolname, false, "SEQUENCE SET", SECTION_DATA, @@ -16233,7 +16233,7 @@ dumpTrigger(Archive *fout, TriggerInfo *tginfo) appendPQExpBuffer(delqry, "DROP TRIGGER %s ", fmtId(tginfo->dobj.name)); appendPQExpBuffer(delqry, "ON %s.", - fmtId(tbinfo->dobj.namespace->dobj.name)); + fmtId(tbinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delqry, "%s;\n", fmtId(tbinfo->dobj.name)); =20 @@ -16388,7 +16388,7 @@ dumpTrigger(Archive *fout, TriggerInfo *tginfo) if (tginfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, tginfo->dobj.catId, tginfo->dobj.dumpId, tag, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, NULL, tbinfo->rolname, false, "TRIGGER", SECTION_POST_DATA, @@ -16398,7 +16398,7 @@ dumpTrigger(Archive *fout, TriggerInfo *tginfo) =20 if (tginfo->dobj.dump & DUMP_COMPONENT_COMMENT) dumpComment(fout, labelq->data, - tbinfo->dobj.namespace->dobj.name, tbinfo->rolname, + tbinfo->dobj.namespaceinfo->dobj.name, tbinfo->rolname, tginfo->dobj.catId, 0, tginfo->dobj.dumpId); =20 free(tag); @@ -16517,7 +16517,7 @@ dumpRule(Archive *fout, RuleInfo *rinfo) /* * Make sure we are in proper schema. */ - selectSourceSchema(fout, tbinfo->dobj.namespace->dobj.name); + selectSourceSchema(fout, tbinfo->dobj.namespaceinfo->dobj.name); =20 query =3D createPQExpBuffer(); cmd =3D createPQExpBuffer(); @@ -16606,7 +16606,7 @@ dumpRule(Archive *fout, RuleInfo *rinfo) PQExpBuffer result; =20 appendPQExpBuffer(delcmd, "CREATE OR REPLACE VIEW %s.", - fmtId(tbinfo->dobj.namespace->dobj.name)); + fmtId(tbinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delcmd, "%s", fmtId(tbinfo->dobj.name)); result =3D createDummyViewAsClause(fout, tbinfo); @@ -16618,7 +16618,7 @@ dumpRule(Archive *fout, RuleInfo *rinfo) appendPQExpBuffer(delcmd, "DROP RULE %s ", fmtId(rinfo->dobj.name)); appendPQExpBuffer(delcmd, "ON %s.", - fmtId(tbinfo->dobj.namespace->dobj.name)); + fmtId(tbinfo->dobj.namespaceinfo->dobj.name)); appendPQExpBuffer(delcmd, "%s;\n", fmtId(tbinfo->dobj.name)); } @@ -16633,7 +16633,7 @@ dumpRule(Archive *fout, RuleInfo *rinfo) if (rinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, rinfo->dobj.catId, rinfo->dobj.dumpId, tag, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, NULL, tbinfo->rolname, false, "RULE", SECTION_POST_DATA, @@ -16644,7 +16644,7 @@ dumpRule(Archive *fout, RuleInfo *rinfo) /* Dump rule comments */ if (rinfo->dobj.dump & DUMP_COMPONENT_COMMENT) dumpComment(fout, labelq->data, - tbinfo->dobj.namespace->dobj.name, + tbinfo->dobj.namespaceinfo->dobj.name, tbinfo->rolname, rinfo->dobj.catId, 0, rinfo->dobj.dumpId); =20 @@ -16839,7 +16839,7 @@ processExtensionTables(Archive *fout, ExtensionInfo= extinfo[], dumpobj =3D true; =20 /* check table's schema explicitly requested */ - if (configtbl->dobj.namespace->dobj.dump & + if (configtbl->dobj.namespaceinfo->dobj.dump & DUMP_COMPONENT_DATA) dumpobj =3D true; } @@ -16852,7 +16852,7 @@ processExtensionTables(Archive *fout, ExtensionInfo= extinfo[], =20 /* check schema excluded by an exclusion switch */ if (simple_oid_list_member(&schema_exclude_oids, - configtbl->dobj.namespace->dobj.catId.oid)) + configtbl->dobj.namespaceinfo->dobj.catId.oid)) dumpobj =3D false; =20 if (dumpobj) diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h index a466527ec6..ef5568f286 100644 --- a/src/bin/pg_dump/pg_dump.h +++ b/src/bin/pg_dump/pg_dump.h @@ -130,7 +130,7 @@ typedef struct _dumpableObject CatalogId catId; /* zero if not a cataloged object */ DumpId dumpId; /* assigned by AssignDumpId() */ char *name; /* object name (should never be NULL) */ - struct _namespaceInfo *namespace; /* containing namespace, or NULL */ + struct _namespaceInfo *namespaceinfo; /* containing namespace, or NULL */ DumpComponents dump; /* bitmask of components to dump */ DumpComponents dump_contains; /* as above, but for contained objects */ bool ext_member; /* true if object is member of extension */ @@ -152,7 +152,7 @@ typedef struct _namespaceInfo typedef struct _extensionInfo { DumpableObject dobj; - char *namespace; /* schema containing extension's objects */ + char *extschema; /* schema containing extension's objects */ bool relocatable; char *extversion; char *extconfig; /* info about configuration tables */ diff --git a/src/bin/pg_dump/pg_dump_sort.c b/src/bin/pg_dump/pg_dump_sort.c index ea643397ba..5a0b6f823b 100644 --- a/src/bin/pg_dump/pg_dump_sort.c +++ b/src/bin/pg_dump/pg_dump_sort.c @@ -224,10 +224,10 @@ DOTypeNameCompare(const void *p1, const void *p2) * either have or not have a namespace link, so we needn't be fancy about * cases where one link is null and the other not. */ - if (obj1->namespace && obj2->namespace) + if (obj1->namespaceinfo && obj2->namespaceinfo) { - cmpval =3D strcmp(obj1->namespace->dobj.name, - obj2->namespace->dobj.name); + cmpval =3D strcmp(obj1->namespaceinfo->dobj.name, + obj2->namespaceinfo->dobj.name); if (cmpval !=3D 0) return cmpval; } @@ -254,10 +254,10 @@ DOTypeNameCompare(const void *p1, const void *p2) =20 if (argtype1 && argtype2) { - if (argtype1->dobj.namespace && argtype2->dobj.namespace) + if (argtype1->dobj.namespaceinfo && argtype2->dobj.namespaceinfo) { - cmpval =3D strcmp(argtype1->dobj.namespace->dobj.name, - argtype2->dobj.namespace->dobj.name); + cmpval =3D strcmp(argtype1->dobj.namespaceinfo->dobj.name, + argtype2->dobj.namespaceinfo->dobj.name); if (cmpval !=3D 0) return cmpval; } diff --git a/src/bin/pg_rewind/parsexlog.c b/src/bin/pg_rewind/parsexlog.c index a7f6fe2df3..c4bc44cb81 100644 --- a/src/bin/pg_rewind/parsexlog.c +++ b/src/bin/pg_rewind/parsexlog.c @@ -65,11 +65,11 @@ extractPageMap(const char *datadir, XLogRecPtr startpoi= nt, int tliIndex, XLogRecord *record; XLogReaderState *xlogreader; char *errormsg; - XLogPageReadPrivate private; + XLogPageReadPrivate private_data; =20 - private.datadir =3D datadir; - private.tliIndex =3D tliIndex; - xlogreader =3D XLogReaderAllocate(&SimpleXLogPageRead, &private); + private_data.datadir =3D datadir; + private_data.tliIndex =3D tliIndex; + xlogreader =3D XLogReaderAllocate(&SimpleXLogPageRead, &private_data); if (xlogreader =3D=3D NULL) pg_fatal("out of memory\n"); =20 @@ -117,12 +117,12 @@ readOneRecord(const char *datadir, XLogRecPtr ptr, in= t tliIndex) XLogRecord *record; XLogReaderState *xlogreader; char *errormsg; - XLogPageReadPrivate private; + XLogPageReadPrivate private_data; XLogRecPtr endptr; =20 - private.datadir =3D datadir; - private.tliIndex =3D tliIndex; - xlogreader =3D XLogReaderAllocate(&SimpleXLogPageRead, &private); + private_data.datadir =3D datadir; + private_data.tliIndex =3D tliIndex; + xlogreader =3D XLogReaderAllocate(&SimpleXLogPageRead, &private_data); if (xlogreader =3D=3D NULL) pg_fatal("out of memory\n"); =20 @@ -161,7 +161,7 @@ findLastCheckpoint(const char *datadir, XLogRecPtr fork= ptr, int tliIndex, XLogRecPtr searchptr; XLogReaderState *xlogreader; char *errormsg; - XLogPageReadPrivate private; + XLogPageReadPrivate private_data; =20 /* * The given fork pointer points to the end of the last common record, @@ -172,9 +172,9 @@ findLastCheckpoint(const char *datadir, XLogRecPtr fork= ptr, int tliIndex, if (forkptr % XLOG_BLCKSZ =3D=3D 0) forkptr +=3D (forkptr % XLogSegSize =3D=3D 0) ? SizeOfXLogLongPHD : Size= OfXLogShortPHD; =20 - private.datadir =3D datadir; - private.tliIndex =3D tliIndex; - xlogreader =3D XLogReaderAllocate(&SimpleXLogPageRead, &private); + private_data.datadir =3D datadir; + private_data.tliIndex =3D tliIndex; + xlogreader =3D XLogReaderAllocate(&SimpleXLogPageRead, &private_data); if (xlogreader =3D=3D NULL) pg_fatal("out of memory\n"); =20 @@ -234,7 +234,7 @@ SimpleXLogPageRead(XLogReaderState *xlogreader, XLogRec= Ptr targetPagePtr, int reqLen, XLogRecPtr targetRecPtr, char *readBuf, TimeLineID *pageTLI) { - XLogPageReadPrivate *private =3D (XLogPageReadPrivate *) xlogreader->priv= ate_data; + XLogPageReadPrivate *private_data =3D (XLogPageReadPrivate *) xlogreader-= >private_data; uint32 targetPageOff; XLogRecPtr targetSegEnd; XLogSegNo targetSegNo; @@ -265,16 +265,16 @@ SimpleXLogPageRead(XLogReaderState *xlogreader, XLogR= ecPtr targetPagePtr, * be done both forward and backward, consider also switching timeline * accordingly. */ - while (private->tliIndex < targetNentries - 1 && - targetHistory[private->tliIndex].end < targetSegEnd) - private->tliIndex++; - while (private->tliIndex > 0 && - targetHistory[private->tliIndex].begin >=3D targetSegEnd) - private->tliIndex--; + while (private_data->tliIndex < targetNentries - 1 && + targetHistory[private_data->tliIndex].end < targetSegEnd) + private_data->tliIndex++; + while (private_data->tliIndex > 0 && + targetHistory[private_data->tliIndex].begin >=3D targetSegEnd) + private_data->tliIndex--; =20 - XLogFileName(xlogfname, targetHistory[private->tliIndex].tli, xlogreadse= gno); + XLogFileName(xlogfname, targetHistory[private_data->tliIndex].tli, xlogr= eadsegno); =20 - snprintf(xlogfpath, MAXPGPATH, "%s/" XLOGDIR "/%s", private->datadir, xl= ogfname); + snprintf(xlogfpath, MAXPGPATH, "%s/" XLOGDIR "/%s", private_data->datadi= r, xlogfname); =20 xlogreadfd =3D open(xlogfpath, O_RDONLY | PG_BINARY, 0); =20 @@ -308,7 +308,7 @@ SimpleXLogPageRead(XLogReaderState *xlogreader, XLogRec= Ptr targetPagePtr, =20 Assert(targetSegNo =3D=3D xlogreadsegno); =20 - *pageTLI =3D targetHistory[private->tliIndex].tli; + *pageTLI =3D targetHistory[private_data->tliIndex].tli; return XLOG_BLCKSZ; } =20 diff --git a/src/bin/pg_waldump/pg_waldump.c b/src/bin/pg_waldump/pg_waldum= p.c index f4bfacfe87..e8fa5ba11c 100644 --- a/src/bin/pg_waldump/pg_waldump.c +++ b/src/bin/pg_waldump/pg_waldump.c @@ -340,23 +340,23 @@ static int XLogDumpReadPage(XLogReaderState *state, XLogRecPtr targetPagePtr, int req= Len, XLogRecPtr targetPtr, char *readBuff, TimeLineID *curFileTLI) { - XLogDumpPrivate *private =3D state->private_data; + XLogDumpPrivate *private_data =3D state->private_data; int count =3D XLOG_BLCKSZ; =20 - if (private->endptr !=3D InvalidXLogRecPtr) + if (private_data->endptr !=3D InvalidXLogRecPtr) { - if (targetPagePtr + XLOG_BLCKSZ <=3D private->endptr) + if (targetPagePtr + XLOG_BLCKSZ <=3D private_data->endptr) count =3D XLOG_BLCKSZ; - else if (targetPagePtr + reqLen <=3D private->endptr) - count =3D private->endptr - targetPagePtr; + else if (targetPagePtr + reqLen <=3D private_data->endptr) + count =3D private_data->endptr - targetPagePtr; else { - private->endptr_reached =3D true; + private_data->endptr_reached =3D true; return -1; } } =20 - XLogDumpXLogRead(private->inpath, private->timeline, targetPagePtr, + XLogDumpXLogRead(private_data->inpath, private_data->timeline, targetPage= Ptr, readBuff, count); =20 return count; @@ -710,7 +710,7 @@ main(int argc, char **argv) uint32 xlogid; uint32 xrecoff; XLogReaderState *xlogreader_state; - XLogDumpPrivate private; + XLogDumpPrivate private_data; XLogDumpConfig config; XLogDumpStats stats; XLogRecord *record; @@ -739,14 +739,14 @@ main(int argc, char **argv) set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_waldump")); progname =3D get_progname(argv[0]); =20 - memset(&private, 0, sizeof(XLogDumpPrivate)); + memset(&private_data, 0, sizeof(XLogDumpPrivate)); memset(&config, 0, sizeof(XLogDumpConfig)); memset(&stats, 0, sizeof(XLogDumpStats)); =20 - private.timeline =3D 1; - private.startptr =3D InvalidXLogRecPtr; - private.endptr =3D InvalidXLogRecPtr; - private.endptr_reached =3D false; + private_data.timeline =3D 1; + private_data.startptr =3D InvalidXLogRecPtr; + private_data.endptr =3D InvalidXLogRecPtr; + private_data.endptr_reached =3D false; =20 config.bkp_details =3D false; config.stop_after_records =3D -1; @@ -779,7 +779,7 @@ main(int argc, char **argv) progname, optarg); goto bad_argument; } - private.endptr =3D (uint64) xlogid << 32 | xrecoff; + private_data.endptr =3D (uint64) xlogid << 32 | xrecoff; break; case 'f': config.follow =3D true; @@ -797,7 +797,7 @@ main(int argc, char **argv) } break; case 'p': - private.inpath =3D pg_strdup(optarg); + private_data.inpath =3D pg_strdup(optarg); break; case 'r': { @@ -834,10 +834,10 @@ main(int argc, char **argv) goto bad_argument; } else - private.startptr =3D (uint64) xlogid << 32 | xrecoff; + private_data.startptr =3D (uint64) xlogid << 32 | xrecoff; break; case 't': - if (sscanf(optarg, "%d", &private.timeline) !=3D 1) + if (sscanf(optarg, "%d", &private_data.timeline) !=3D 1) { fprintf(stderr, _("%s: could not parse timeline \"%s\"\n"), progname, optarg); @@ -885,14 +885,14 @@ main(int argc, char **argv) goto bad_argument; } =20 - if (private.inpath !=3D NULL) + if (private_data.inpath !=3D NULL) { /* validate path points to directory */ - if (!verify_directory(private.inpath)) + if (!verify_directory(private_data.inpath)) { fprintf(stderr, _("%s: path \"%s\" cannot be opened: %s\n"), - progname, private.inpath, strerror(errno)); + progname, private_data.inpath, strerror(errno)); goto bad_argument; } } @@ -907,39 +907,39 @@ main(int argc, char **argv) =20 split_path(argv[optind], &directory, &fname); =20 - if (private.inpath =3D=3D NULL && directory !=3D NULL) + if (private_data.inpath =3D=3D NULL && directory !=3D NULL) { - private.inpath =3D directory; + private_data.inpath =3D directory; =20 - if (!verify_directory(private.inpath)) + if (!verify_directory(private_data.inpath)) fatal_error("cannot open directory \"%s\": %s", - private.inpath, strerror(errno)); + private_data.inpath, strerror(errno)); } =20 - fd =3D fuzzy_open_file(private.inpath, fname); + fd =3D fuzzy_open_file(private_data.inpath, fname); if (fd < 0) fatal_error("could not open file \"%s\"", fname); close(fd); =20 /* parse position from file */ - XLogFromFileName(fname, &private.timeline, &segno); + XLogFromFileName(fname, &private_data.timeline, &segno); =20 - if (XLogRecPtrIsInvalid(private.startptr)) - XLogSegNoOffsetToRecPtr(segno, 0, private.startptr); - else if (!XLByteInSeg(private.startptr, segno)) + if (XLogRecPtrIsInvalid(private_data.startptr)) + XLogSegNoOffsetToRecPtr(segno, 0, private_data.startptr); + else if (!XLByteInSeg(private_data.startptr, segno)) { fprintf(stderr, _("%s: start log position %X/%X is not inside file \"%s\"\n"), progname, - (uint32) (private.startptr >> 32), - (uint32) private.startptr, + (uint32) (private_data.startptr >> 32), + (uint32) private_data.startptr, fname); goto bad_argument; } =20 /* no second file specified, set end position */ - if (!(optind + 1 < argc) && XLogRecPtrIsInvalid(private.endptr)) - XLogSegNoOffsetToRecPtr(segno + 1, 0, private.endptr); + if (!(optind + 1 < argc) && XLogRecPtrIsInvalid(private_data.endptr)) + XLogSegNoOffsetToRecPtr(segno + 1, 0, private_data.endptr); =20 /* parse ENDSEG if passed */ if (optind + 1 < argc) @@ -949,41 +949,41 @@ main(int argc, char **argv) /* ignore directory, already have that */ split_path(argv[optind + 1], &directory, &fname); =20 - fd =3D fuzzy_open_file(private.inpath, fname); + fd =3D fuzzy_open_file(private_data.inpath, fname); if (fd < 0) fatal_error("could not open file \"%s\"", fname); close(fd); =20 /* parse position from file */ - XLogFromFileName(fname, &private.timeline, &endsegno); + XLogFromFileName(fname, &private_data.timeline, &endsegno); =20 if (endsegno < segno) fatal_error("ENDSEG %s is before STARTSEG %s", argv[optind + 1], argv[optind]); =20 - if (XLogRecPtrIsInvalid(private.endptr)) - XLogSegNoOffsetToRecPtr(endsegno + 1, 0, private.endptr); + if (XLogRecPtrIsInvalid(private_data.endptr)) + XLogSegNoOffsetToRecPtr(endsegno + 1, 0, private_data.endptr); =20 /* set segno to endsegno for check of --end */ segno =3D endsegno; } =20 =20 - if (!XLByteInSeg(private.endptr, segno) && - private.endptr !=3D (segno + 1) * XLogSegSize) + if (!XLByteInSeg(private_data.endptr, segno) && + private_data.endptr !=3D (segno + 1) * XLogSegSize) { fprintf(stderr, _("%s: end log position %X/%X is not inside file \"%s\"\n"), progname, - (uint32) (private.endptr >> 32), - (uint32) private.endptr, + (uint32) (private_data.endptr >> 32), + (uint32) private_data.endptr, argv[argc - 1]); goto bad_argument; } } =20 /* we don't know what to print */ - if (XLogRecPtrIsInvalid(private.startptr)) + if (XLogRecPtrIsInvalid(private_data.startptr)) { fprintf(stderr, _("%s: no start log position given.\n"), progname); goto bad_argument; @@ -992,28 +992,28 @@ main(int argc, char **argv) /* done with argument parsing, do the actual work */ =20 /* we have everything we need, start reading */ - xlogreader_state =3D XLogReaderAllocate(XLogDumpReadPage, &private); + xlogreader_state =3D XLogReaderAllocate(XLogDumpReadPage, &private_data); if (!xlogreader_state) fatal_error("out of memory"); =20 /* first find a valid recptr to start from */ - first_record =3D XLogFindNextRecord(xlogreader_state, private.startptr); + first_record =3D XLogFindNextRecord(xlogreader_state, private_data.startp= tr); =20 if (first_record =3D=3D InvalidXLogRecPtr) fatal_error("could not find a valid record after %X/%X", - (uint32) (private.startptr >> 32), - (uint32) private.startptr); + (uint32) (private_data.startptr >> 32), + (uint32) private_data.startptr); =20 /* * Display a message that we're skipping data if `from` wasn't a pointer * to the start of a record and also wasn't a pointer to the beginning of * a segment (e.g. we were used in file mode). */ - if (first_record !=3D private.startptr && (private.startptr % XLogSegSize= ) !=3D 0) + if (first_record !=3D private_data.startptr && (private_data.startptr % X= LogSegSize) !=3D 0) printf(_("first record is after %X/%X, at %X/%X, skipping over %u bytes\= n"), - (uint32) (private.startptr >> 32), (uint32) private.startptr, + (uint32) (private_data.startptr >> 32), (uint32) private_data.startp= tr, (uint32) (first_record >> 32), (uint32) first_record, - (uint32) (first_record - private.startptr)); + (uint32) (first_record - private_data.startptr)); =20 for (;;) { @@ -1021,7 +1021,7 @@ main(int argc, char **argv) record =3D XLogReadRecord(xlogreader_state, first_record, &errormsg); if (!record) { - if (!config.follow || private.endptr_reached) + if (!config.follow || private_data.endptr_reached) break; else { diff --git a/src/bin/pgbench/exprparse.y b/src/bin/pgbench/exprparse.y index b3a2d9bfd3..fc8fa231c9 100644 --- a/src/bin/pgbench/exprparse.y +++ b/src/bin/pgbench/exprparse.y @@ -22,7 +22,7 @@ static PgBenchExprList *make_elist(PgBenchExpr *exp, PgBe= nchExprList *list); static PgBenchExpr *make_integer_constant(int64 ival); static PgBenchExpr *make_double_constant(double dval); static PgBenchExpr *make_variable(char *varname); -static PgBenchExpr *make_op(yyscan_t yyscanner, const char *operator, +static PgBenchExpr *make_op(yyscan_t yyscanner, const char *oper, PgBenchExpr *lexpr, PgBenchExpr *rexpr); static int find_func(yyscan_t yyscanner, const char *fname); static PgBenchExpr *make_func(yyscan_t yyscanner, int fnumber, PgBenchExpr= List *args); @@ -120,10 +120,10 @@ make_variable(char *varname) } =20 static PgBenchExpr * -make_op(yyscan_t yyscanner, const char *operator, +make_op(yyscan_t yyscanner, const char *oper, PgBenchExpr *lexpr, PgBenchExpr *rexpr) { - return make_func(yyscanner, find_func(yyscanner, operator), + return make_func(yyscanner, find_func(yyscanner, oper), make_elist(rexpr, make_elist(lexpr, NULL))); } =20 diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index ddad71a10f..cbd2908f38 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -97,10 +97,10 @@ typedef struct SchemaQuery const char *viscondition; =20 /* - * Namespace --- name of field to join to pg_namespace.oid. For example, + * Namespaceatt --- name of field to join to pg_namespace.oid. For exampl= e, * "c.relnamespace". */ - const char *namespace; + const char *namespaceatt; =20 /* * Result --- the appropriately-quoted name to return, in the case of an @@ -348,7 +348,7 @@ static const SchemaQuery Query_for_list_of_aggregates = =3D { "p.proisagg", /* viscondition */ "pg_catalog.pg_function_is_visible(p.oid)", - /* namespace */ + /* namespaceatt */ "p.pronamespace", /* result */ "pg_catalog.quote_ident(p.proname)", @@ -365,7 +365,7 @@ static const SchemaQuery Query_for_list_of_datatypes = =3D { "AND t.typname !~ '^_'", /* viscondition */ "pg_catalog.pg_type_is_visible(t.oid)", - /* namespace */ + /* namespaceatt */ "t.typnamespace", /* result */ "pg_catalog.format_type(t.oid, NULL)", @@ -380,7 +380,7 @@ static const SchemaQuery Query_for_list_of_domains =3D { "t.typtype =3D 'd'", /* viscondition */ "pg_catalog.pg_type_is_visible(t.oid)", - /* namespace */ + /* namespaceatt */ "t.typnamespace", /* result */ "pg_catalog.quote_ident(t.typname)", @@ -395,7 +395,7 @@ static const SchemaQuery Query_for_list_of_functions = =3D { NULL, /* viscondition */ "pg_catalog.pg_function_is_visible(p.oid)", - /* namespace */ + /* namespaceatt */ "p.pronamespace", /* result */ "pg_catalog.quote_ident(p.proname)", @@ -410,7 +410,7 @@ static const SchemaQuery Query_for_list_of_indexes =3D { "c.relkind IN ('i')", /* viscondition */ "pg_catalog.pg_table_is_visible(c.oid)", - /* namespace */ + /* namespaceatt */ "c.relnamespace", /* result */ "pg_catalog.quote_ident(c.relname)", @@ -425,7 +425,7 @@ static const SchemaQuery Query_for_list_of_sequences = =3D { "c.relkind IN ('S')", /* viscondition */ "pg_catalog.pg_table_is_visible(c.oid)", - /* namespace */ + /* namespaceatt */ "c.relnamespace", /* result */ "pg_catalog.quote_ident(c.relname)", @@ -440,7 +440,7 @@ static const SchemaQuery Query_for_list_of_foreign_tabl= es =3D { "c.relkind IN ('f')", /* viscondition */ "pg_catalog.pg_table_is_visible(c.oid)", - /* namespace */ + /* namespaceatt */ "c.relnamespace", /* result */ "pg_catalog.quote_ident(c.relname)", @@ -455,7 +455,7 @@ static const SchemaQuery Query_for_list_of_tables =3D { "c.relkind IN ('r', 'P')", /* viscondition */ "pg_catalog.pg_table_is_visible(c.oid)", - /* namespace */ + /* namespaceatt */ "c.relnamespace", /* result */ "pg_catalog.quote_ident(c.relname)", @@ -470,7 +470,7 @@ static const SchemaQuery Query_for_list_of_partitioned_= tables =3D { "c.relkind IN ('P')", /* viscondition */ "pg_catalog.pg_table_is_visible(c.oid)", - /* namespace */ + /* namespaceatt */ "c.relnamespace", /* result */ "pg_catalog.quote_ident(c.relname)", @@ -485,7 +485,7 @@ static const SchemaQuery Query_for_list_of_constraints_= with_schema =3D { "c.conrelid <> 0", /* viscondition */ "true", /* there is no pg_constraint_is_visible */ - /* namespace */ + /* namespaceatt */ "c.connamespace", /* result */ "pg_catalog.quote_ident(c.conname)", @@ -501,7 +501,7 @@ static const SchemaQuery Query_for_list_of_updatables = =3D { "c.relkind IN ('r', 'f', 'v', 'P')", /* viscondition */ "pg_catalog.pg_table_is_visible(c.oid)", - /* namespace */ + /* namespaceatt */ "c.relnamespace", /* result */ "pg_catalog.quote_ident(c.relname)", @@ -516,7 +516,7 @@ static const SchemaQuery Query_for_list_of_relations = =3D { NULL, /* viscondition */ "pg_catalog.pg_table_is_visible(c.oid)", - /* namespace */ + /* namespaceatt */ "c.relnamespace", /* result */ "pg_catalog.quote_ident(c.relname)", @@ -531,7 +531,7 @@ static const SchemaQuery Query_for_list_of_tsvmf =3D { "c.relkind IN ('r', 'S', 'v', 'm', 'f', 'P')", /* viscondition */ "pg_catalog.pg_table_is_visible(c.oid)", - /* namespace */ + /* namespaceatt */ "c.relnamespace", /* result */ "pg_catalog.quote_ident(c.relname)", @@ -546,7 +546,7 @@ static const SchemaQuery Query_for_list_of_tmf =3D { "c.relkind IN ('r', 'm', 'f')", /* viscondition */ "pg_catalog.pg_table_is_visible(c.oid)", - /* namespace */ + /* namespaceatt */ "c.relnamespace", /* result */ "pg_catalog.quote_ident(c.relname)", @@ -561,7 +561,7 @@ static const SchemaQuery Query_for_list_of_tm =3D { "c.relkind IN ('r', 'm')", /* viscondition */ "pg_catalog.pg_table_is_visible(c.oid)", - /* namespace */ + /* namespaceatt */ "c.relnamespace", /* result */ "pg_catalog.quote_ident(c.relname)", @@ -576,7 +576,7 @@ static const SchemaQuery Query_for_list_of_views =3D { "c.relkind IN ('v')", /* viscondition */ "pg_catalog.pg_table_is_visible(c.oid)", - /* namespace */ + /* namespaceatt */ "c.relnamespace", /* result */ "pg_catalog.quote_ident(c.relname)", @@ -591,7 +591,7 @@ static const SchemaQuery Query_for_list_of_matviews =3D= { "c.relkind IN ('m')", /* viscondition */ "pg_catalog.pg_table_is_visible(c.oid)", - /* namespace */ + /* namespaceatt */ "c.relnamespace", /* result */ "pg_catalog.quote_ident(c.relname)", @@ -3645,7 +3645,7 @@ _complete_from_query(int is_schema_query, const char = *text, int state) "WHERE %s =3D n.oid AND ", qualresult, completion_squery->catname, - completion_squery->namespace); + completion_squery->namespaceatt); if (completion_squery->selcondition) appendPQExpBuffer(&query_buffer, "%s AND ", completion_squery->selcondition); diff --git a/src/bin/scripts/createdb.c b/src/bin/scripts/createdb.c index 88ea401e39..0011505fde 100644 --- a/src/bin/scripts/createdb.c +++ b/src/bin/scripts/createdb.c @@ -53,7 +53,7 @@ main(int argc, char *argv[]) bool echo =3D false; char *owner =3D NULL; char *tablespace =3D NULL; - char *template =3D NULL; + char *templatedb =3D NULL; char *encoding =3D NULL; char *lc_collate =3D NULL; char *lc_ctype =3D NULL; @@ -98,7 +98,7 @@ main(int argc, char *argv[]) tablespace =3D pg_strdup(optarg); break; case 'T': - template =3D pg_strdup(optarg); + templatedb =3D pg_strdup(optarg); break; case 'E': encoding =3D pg_strdup(optarg); @@ -188,8 +188,8 @@ main(int argc, char *argv[]) appendPQExpBuffer(&sql, " TABLESPACE %s", fmtId(tablespace)); if (encoding) appendPQExpBuffer(&sql, " ENCODING '%s'", encoding); - if (template) - appendPQExpBuffer(&sql, " TEMPLATE %s", fmtId(template)); + if (templatedb) + appendPQExpBuffer(&sql, " TEMPLATE %s", fmtId(templatedb)); if (lc_collate) appendPQExpBuffer(&sql, " LC_COLLATE '%s'", lc_collate); if (lc_ctype) diff --git a/src/interfaces/ecpg/compatlib/informix.c b/src/interfaces/ecpg= /compatlib/informix.c index e50aa5ec65..79e2889f5f 100644 --- a/src/interfaces/ecpg/compatlib/informix.c +++ b/src/interfaces/ecpg/compatlib/informix.c @@ -181,17 +181,17 @@ ecpg_strndup(const char *str, size_t len) size_t real_len =3D strlen(str); int use_len =3D (int) ((real_len > len) ? len : real_len); =20 - char *new =3D malloc(use_len + 1); + char *newstr =3D malloc(use_len + 1); =20 - if (new) + if (newstr) { - memcpy(new, str, use_len); - new[use_len] =3D '\0'; + memcpy(newstr, str, use_len); + newstr[use_len] =3D '\0'; } else errno =3D ENOMEM; =20 - return new; + return newstr; } =20 int diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ec= pglib/connect.c index c90f13dc6c..e8ee7ddadd 100644 --- a/src/interfaces/ecpg/ecpglib/connect.c +++ b/src/interfaces/ecpg/ecpglib/connect.c @@ -272,7 +272,7 @@ ECPGconnect(int lineno, int c, const char *name, const = char *user, const char *p { struct sqlca_t *sqlca =3D ECPGget_sqlca(); enum COMPAT_MODE compat =3D c; - struct connection *this; + struct connection *conn; int i, connect_params =3D 0; char *dbname =3D name ? ecpg_strdup(name, lineno) : NULL, @@ -334,7 +334,7 @@ ECPGconnect(int lineno, int c, const char *name, const = char *user, const char *p return false; } =20 - if ((this =3D (struct connection *) ecpg_alloc(sizeof(struct connection),= lineno)) =3D=3D NULL) + if ((conn =3D (struct connection *) ecpg_alloc(sizeof(struct connection),= lineno)) =3D=3D NULL) { ecpg_free(dbname); return false; @@ -411,7 +411,7 @@ ECPGconnect(int lineno, int c, const char *name, const = char *user, const char *p ecpg_free(realname); if (dbname) ecpg_free(dbname); - free(this); + free(conn); return false; } } @@ -438,7 +438,7 @@ ECPGconnect(int lineno, int c, const char *name, const = char *user, const char *p ecpg_free(realname); if (dbname) ecpg_free(dbname); - free(this); + free(conn); return false; } } @@ -489,19 +489,19 @@ ECPGconnect(int lineno, int c, const char *name, cons= t char *user, const char *p pthread_mutex_lock(&connections_mutex); #endif if (connection_name !=3D NULL) - this->name =3D ecpg_strdup(connection_name, lineno); + conn->name =3D ecpg_strdup(connection_name, lineno); else - this->name =3D ecpg_strdup(realname, lineno); + conn->name =3D ecpg_strdup(realname, lineno); =20 - this->cache_head =3D NULL; - this->prep_stmts =3D NULL; + conn->cache_head =3D NULL; + conn->prep_stmts =3D NULL; =20 if (all_connections =3D=3D NULL) - this->next =3D NULL; + conn->next =3D NULL; else - this->next =3D all_connections; + conn->next =3D all_connections; =20 - all_connections =3D this; + all_connections =3D conn; #ifdef ENABLE_THREAD_SAFETY pthread_setspecific(actual_connection_key, all_connections); #endif @@ -544,7 +544,7 @@ ECPGconnect(int lineno, int c, const char *name, const = char *user, const char *p ecpg_free(conn_keywords); if (conn_values) ecpg_free(conn_values); - free(this); + free(conn); return false; } =20 @@ -619,7 +619,7 @@ ECPGconnect(int lineno, int c, const char *name, const = char *user, const char *p } conn_keywords[i] =3D NULL; /* terminator */ =20 - this->connection =3D PQconnectdbParams(conn_keywords, conn_values, 0); + conn->connection =3D PQconnectdbParams(conn_keywords, conn_values, 0); =20 if (host) ecpg_free(host); @@ -632,14 +632,14 @@ ECPGconnect(int lineno, int c, const char *name, cons= t char *user, const char *p ecpg_free(conn_values); ecpg_free(conn_keywords); =20 - if (PQstatus(this->connection) =3D=3D CONNECTION_BAD) + if (PQstatus(conn->connection) =3D=3D CONNECTION_BAD) { - const char *errmsg =3D PQerrorMessage(this->connection); + const char *errmsg =3D PQerrorMessage(conn->connection); const char *db =3D realname ? realname : ecpg_gettext(""); =20 ecpg_log("ECPGconnect: could not open database: %s\n", errmsg); =20 - ecpg_finish(this); + ecpg_finish(conn); #ifdef ENABLE_THREAD_SAFETY pthread_mutex_unlock(&connections_mutex); #endif @@ -658,9 +658,9 @@ ECPGconnect(int lineno, int c, const char *name, const = char *user, const char *p pthread_mutex_unlock(&connections_mutex); #endif =20 - this->autocommit =3D autocommit; + conn->autocommit =3D autocommit; =20 - PQsetNoticeReceiver(this->connection, &ECPGnoticeReceiver, (void *) this); + PQsetNoticeReceiver(conn->connection, &ECPGnoticeReceiver, (void *) conn); =20 return true; } diff --git a/src/interfaces/ecpg/ecpglib/descriptor.c b/src/interfaces/ecpg= /ecpglib/descriptor.c index 15fd7a08a5..79a8e4bea5 100644 --- a/src/interfaces/ecpg/ecpglib/descriptor.c +++ b/src/interfaces/ecpg/ecpglib/descriptor.c @@ -758,7 +758,7 @@ descriptor_deallocate_all(struct descriptor * list) bool ECPGallocate_desc(int line, const char *name) { - struct descriptor *new; + struct descriptor *newdesc; struct sqlca_t *sqlca =3D ECPGget_sqlca(); =20 if (sqlca =3D=3D NULL) @@ -769,28 +769,28 @@ ECPGallocate_desc(int line, const char *name) } =20 ecpg_init_sqlca(sqlca); - new =3D (struct descriptor *) ecpg_alloc(sizeof(struct descriptor), line); - if (!new) + newdesc =3D (struct descriptor *) ecpg_alloc(sizeof(struct descriptor), l= ine); + if (!newdesc) return false; - new->next =3D get_descriptors(); - new->name =3D ecpg_alloc(strlen(name) + 1, line); - if (!new->name) + newdesc->next =3D get_descriptors(); + newdesc->name =3D ecpg_alloc(strlen(name) + 1, line); + if (!newdesc->name) { - ecpg_free(new); + ecpg_free(newdesc); return false; } - new->count =3D -1; - new->items =3D NULL; - new->result =3D PQmakeEmptyPGresult(NULL, 0); - if (!new->result) + newdesc->count =3D -1; + newdesc->items =3D NULL; + newdesc->result =3D PQmakeEmptyPGresult(NULL, 0); + if (!newdesc->result) { - ecpg_free(new->name); - ecpg_free(new); + ecpg_free(newdesc->name); + ecpg_free(newdesc); ecpg_raise(line, ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, N= ULL); return false; } - strcpy(new->name, name); - set_descriptors(new); + strcpy(newdesc->name, name); + set_descriptors(newdesc); return true; } =20 diff --git a/src/interfaces/ecpg/ecpglib/memory.c b/src/interfaces/ecpg/ecp= glib/memory.c index 9c1d20efc5..82a97b17e2 100644 --- a/src/interfaces/ecpg/ecpglib/memory.c +++ b/src/interfaces/ecpg/ecpglib/memory.c @@ -18,47 +18,47 @@ ecpg_free(void *ptr) char * ecpg_alloc(long size, int lineno) { - char *new =3D (char *) calloc(1L, size); + char *newval =3D (char *) calloc(1L, size); =20 - if (!new) + if (!newval) { ecpg_raise(lineno, ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY,= NULL); return NULL; } =20 - return (new); + return (newval); } =20 char * ecpg_realloc(void *ptr, long size, int lineno) { - char *new =3D (char *) realloc(ptr, size); + char *newval =3D (char *) realloc(ptr, size); =20 - if (!new) + if (!newval) { ecpg_raise(lineno, ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY,= NULL); return NULL; } =20 - return (new); + return (newval); } =20 char * ecpg_strdup(const char *string, int lineno) { - char *new; + char *newval; =20 if (string =3D=3D NULL) return NULL; =20 - new =3D strdup(string); - if (!new) + newval =3D strdup(string); + if (!newval) { ecpg_raise(lineno, ECPG_OUT_OF_MEMORY, ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY,= NULL); return NULL; } =20 - return (new); + return (newval); } =20 /* keep a list of memory we allocated for the user */ diff --git a/src/interfaces/ecpg/ecpglib/prepare.c b/src/interfaces/ecpg/ec= pglib/prepare.c index 983b242d06..b10b6a8943 100644 --- a/src/interfaces/ecpg/ecpglib/prepare.c +++ b/src/interfaces/ecpg/ecpglib/prepare.c @@ -28,7 +28,7 @@ static const int stmtCacheEntPerBucket =3D 8; /* # entri= es/bucket */ static stmtCacheEntry stmtCacheEntries[16384] =3D {{0, {0}, 0, 0, 0}}; =20 static bool deallocate_one(int lineno, enum COMPAT_MODE c, struct connecti= on * con, - struct prepared_statement * prev, struct prepared_statement * this); + struct prepared_statement * prev, struct prepared_statement * prep); =20 static bool isvarchar(unsigned char c) @@ -103,18 +103,18 @@ static bool prepare_common(int lineno, struct connection * con, const char *name, cons= t char *variable) { struct statement *stmt; - struct prepared_statement *this; + struct prepared_statement *prep; PGresult *query; =20 /* allocate new statement */ - this =3D (struct prepared_statement *) ecpg_alloc(sizeof(struct prepared_= statement), lineno); - if (!this) + prep =3D (struct prepared_statement *) ecpg_alloc(sizeof(struct prepared_= statement), lineno); + if (!prep) return false; =20 stmt =3D (struct statement *) ecpg_alloc(sizeof(struct statement), lineno= ); if (!stmt) { - ecpg_free(this); + ecpg_free(prep); return false; } =20 @@ -128,30 +128,30 @@ prepare_common(int lineno, struct connection * con, c= onst char *name, const char replace_variables(&(stmt->command), lineno); =20 /* add prepared statement to our list */ - this->name =3D ecpg_strdup(name, lineno); - this->stmt =3D stmt; + prep->name =3D ecpg_strdup(name, lineno); + prep->stmt =3D stmt; =20 /* and finally really prepare the statement */ query =3D PQprepare(stmt->connection->connection, name, stmt->command, 0,= NULL); if (!ecpg_check_PQresult(query, stmt->lineno, stmt->connection->connectio= n, stmt->compat)) { ecpg_free(stmt->command); - ecpg_free(this->name); - ecpg_free(this); + ecpg_free(prep->name); + ecpg_free(prep); ecpg_free(stmt); return false; } =20 ecpg_log("prepare_common on line %d: name %s; query: \"%s\"\n", stmt->lin= eno, name, stmt->command); PQclear(query); - this->prepared =3D true; + prep->prepared =3D true; =20 if (con->prep_stmts =3D=3D NULL) - this->next =3D NULL; + prep->next =3D NULL; else - this->next =3D con->prep_stmts; + prep->next =3D con->prep_stmts; =20 - con->prep_stmts =3D this; + con->prep_stmts =3D prep; return true; } =20 @@ -161,7 +161,7 @@ bool ECPGprepare(int lineno, const char *connection_name, const bool questionma= rks, const char *name, const char *variable) { struct connection *con; - struct prepared_statement *this, + struct prepared_statement *prep, *prev; =20 (void) questionmarks; /* quiet the compiler */ @@ -171,8 +171,8 @@ ECPGprepare(int lineno, const char *connection_name, co= nst bool questionmarks, c return false; =20 /* check if we already have prepared this statement */ - this =3D ecpg_find_prepared_statement(name, con, &prev); - if (this && !deallocate_one(lineno, ECPG_COMPAT_PGSQL, con, prev, this)) + prep =3D ecpg_find_prepared_statement(name, con, &prev); + if (prep && !deallocate_one(lineno, ECPG_COMPAT_PGSQL, con, prev, prep)) return false; =20 return prepare_common(lineno, con, name, variable); @@ -182,42 +182,42 @@ struct prepared_statement * ecpg_find_prepared_statement(const char *name, struct connection * con, struct prepared_statement ** prev_) { - struct prepared_statement *this, + struct prepared_statement *prep, *prev; =20 - for (this =3D con->prep_stmts, prev =3D NULL; this !=3D NULL; prev =3D th= is, this =3D this->next) + for (prep =3D con->prep_stmts, prev =3D NULL; prep !=3D NULL; prev =3D pr= ep, prep =3D prep->next) { - if (strcmp(this->name, name) =3D=3D 0) + if (strcmp(prep->name, name) =3D=3D 0) { if (prev_) *prev_ =3D prev; - return this; + return prep; } } return NULL; } =20 static bool -deallocate_one(int lineno, enum COMPAT_MODE c, struct connection * con, st= ruct prepared_statement * prev, struct prepared_statement * this) +deallocate_one(int lineno, enum COMPAT_MODE c, struct connection * con, st= ruct prepared_statement * prev, struct prepared_statement * prep) { bool r =3D false; =20 - ecpg_log("deallocate_one on line %d: name %s\n", lineno, this->name); + ecpg_log("deallocate_one on line %d: name %s\n", lineno, prep->name); =20 /* first deallocate the statement in the backend */ - if (this->prepared) + if (prep->prepared) { char *text; PGresult *query; =20 - text =3D (char *) ecpg_alloc(strlen("deallocate \"\" ") + strlen(this->n= ame), this->stmt->lineno); + text =3D (char *) ecpg_alloc(strlen("deallocate \"\" ") + strlen(prep->n= ame), prep->stmt->lineno); =20 if (text) { - sprintf(text, "deallocate \"%s\"", this->name); - query =3D PQexec(this->stmt->connection->connection, text); + sprintf(text, "deallocate \"%s\"", prep->name); + query =3D PQexec(prep->stmt->connection->connection, text); ecpg_free(text); - if (ecpg_check_PQresult(query, lineno, this->stmt->connection->connecti= on, this->stmt->compat)) + if (ecpg_check_PQresult(query, lineno, prep->stmt->connection->connecti= on, prep->stmt->compat)) { PQclear(query); r =3D true; @@ -231,20 +231,20 @@ deallocate_one(int lineno, enum COMPAT_MODE c, struct= connection * con, struct p */ if (!r && !INFORMIX_MODE(c)) { - ecpg_raise(lineno, ECPG_INVALID_STMT, ECPG_SQLSTATE_INVALID_SQL_STATEMEN= T_NAME, this->name); + ecpg_raise(lineno, ECPG_INVALID_STMT, ECPG_SQLSTATE_INVALID_SQL_STATEMEN= T_NAME, prep->name); return false; } =20 /* okay, free all the resources */ - ecpg_free(this->stmt->command); - ecpg_free(this->stmt); - ecpg_free(this->name); + ecpg_free(prep->stmt->command); + ecpg_free(prep->stmt); + ecpg_free(prep->name); if (prev !=3D NULL) - prev->next =3D this->next; + prev->next =3D prep->next; else - con->prep_stmts =3D this->next; + con->prep_stmts =3D prep->next; =20 - ecpg_free(this); + ecpg_free(prep); return true; } =20 @@ -253,7 +253,7 @@ bool ECPGdeallocate(int lineno, int c, const char *connection_name, const char = *name) { struct connection *con; - struct prepared_statement *this, + struct prepared_statement *prep, *prev; =20 con =3D ecpg_get_connection(connection_name); @@ -261,9 +261,9 @@ ECPGdeallocate(int lineno, int c, const char *connectio= n_name, const char *name) if (!ecpg_init(con, connection_name, lineno)) return false; =20 - this =3D ecpg_find_prepared_statement(name, con, &prev); - if (this) - return deallocate_one(lineno, c, con, prev, this); + prep =3D ecpg_find_prepared_statement(name, con, &prev); + if (prep) + return deallocate_one(lineno, c, con, prev, prep); =20 /* prepared statement is not found */ if (INFORMIX_MODE(c)) @@ -294,10 +294,10 @@ ECPGdeallocate_all(int lineno, int compat, const char= *connection_name) char * ecpg_prepared(const char *name, struct connection * con) { - struct prepared_statement *this; + struct prepared_statement *prep; =20 - this =3D ecpg_find_prepared_statement(name, con, NULL); - return this ? this->stmt->command : NULL; + prep =3D ecpg_find_prepared_statement(name, con, NULL); + return prep ? prep->stmt->command : NULL; } =20 /* return the prepared statement */ @@ -384,7 +384,7 @@ ecpg_freeStmtCacheEntry(int lineno, int compat, int ent= No) /* entry # to free * { stmtCacheEntry *entry; struct connection *con; - struct prepared_statement *this, + struct prepared_statement *prep, *prev; =20 entry =3D &stmtCacheEntries[entNo]; @@ -394,8 +394,8 @@ ecpg_freeStmtCacheEntry(int lineno, int compat, int ent= No) /* entry # to free * con =3D ecpg_get_connection(entry->connection); =20 /* free the 'prepared_statement' list entry */ - this =3D ecpg_find_prepared_statement(entry->stmtID, con, &prev); - if (this && !deallocate_one(lineno, compat, con, prev, this)) + prep =3D ecpg_find_prepared_statement(entry->stmtID, con, &prev); + if (prep && !deallocate_one(lineno, compat, con, prev, prep)) return (-1); =20 entry->stmtID[0] =3D '\0'; diff --git a/src/interfaces/ecpg/pgtypeslib/common.c b/src/interfaces/ecpg/= pgtypeslib/common.c index 9084fd06b4..d49fbb13ed 100644 --- a/src/interfaces/ecpg/pgtypeslib/common.c +++ b/src/interfaces/ecpg/pgtypeslib/common.c @@ -8,21 +8,21 @@ char * pgtypes_alloc(long size) { - char *new =3D (char *) calloc(1L, size); + char *newval =3D (char *) calloc(1L, size); =20 - if (!new) + if (!newval) errno =3D ENOMEM; - return (new); + return (newval); } =20 char * pgtypes_strdup(const char *str) { - char *new =3D (char *) strdup(str); + char *newval =3D (char *) strdup(str); =20 - if (!new) + if (!newval) errno =3D ENOMEM; - return (new); + return (newval); } =20 int diff --git a/src/interfaces/ecpg/preproc/descriptor.c b/src/interfaces/ecpg= /preproc/descriptor.c index c6442c1805..00e22c8173 100644 --- a/src/interfaces/ecpg/preproc/descriptor.c +++ b/src/interfaces/ecpg/preproc/descriptor.c @@ -20,13 +20,13 @@ static struct assignment *assignments; void push_assignment(char *var, enum ECPGdtype value) { - struct assignment *new =3D (struct assignment *) mm_alloc(sizeof(struct a= ssignment)); + struct assignment *newa =3D (struct assignment *) mm_alloc(sizeof(struct = assignment)); =20 - new->next =3D assignments; - new->variable =3D mm_alloc(strlen(var) + 1); - strcpy(new->variable, var); - new->value =3D value; - assignments =3D new; + newa->next =3D assignments; + newa->variable =3D mm_alloc(strlen(var) + 1); + strcpy(newa->variable, var); + newa->value =3D value; + assignments =3D newa; } =20 static void @@ -75,24 +75,24 @@ static struct descriptor *descriptors; void add_descriptor(char *name, char *connection) { - struct descriptor *new; + struct descriptor *newd; =20 if (name[0] !=3D '"') return; =20 - new =3D (struct descriptor *) mm_alloc(sizeof(struct descriptor)); + newd =3D (struct descriptor *) mm_alloc(sizeof(struct descriptor)); =20 - new->next =3D descriptors; - new->name =3D mm_alloc(strlen(name) + 1); - strcpy(new->name, name); + newd->next =3D descriptors; + newd->name =3D mm_alloc(strlen(name) + 1); + strcpy(newd->name, name); if (connection) { - new->connection =3D mm_alloc(strlen(connection) + 1); - strcpy(new->connection, connection); + newd->connection =3D mm_alloc(strlen(connection) + 1); + strcpy(newd->connection, connection); } else - new->connection =3D connection; - descriptors =3D new; + newd->connection =3D connection; + descriptors =3D newd; } =20 void diff --git a/src/interfaces/ecpg/preproc/ecpg.addons b/src/interfaces/ecpg/= preproc/ecpg.addons index ca3efadc48..ff991de6bf 100644 --- a/src/interfaces/ecpg/preproc/ecpg.addons +++ b/src/interfaces/ecpg/preproc/ecpg.addons @@ -287,7 +287,7 @@ ECPG: ExecuteStmtEXECUTEprepared_nameexecute_param_clau= seexecute_rest block { $$ =3D $2; } ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSe= lectStmt block { - struct cursor *ptr, *this; + struct cursor *ptr, *cursor; char *cursor_marker =3D $2[0] =3D=3D ':' ? mm_strdup("$0") : mm_strdup($= 2); char *comment, *c1, *c2; int (* strcmp_fn)(const char *, const char *) =3D (($2[0] =3D=3D ':' || = $2[0] =3D=3D '"') ? strcmp : pg_strcasecmp); @@ -303,22 +303,22 @@ ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optio= nsCURSORopt_holdFORSelectSt } } =20 - this =3D (struct cursor *) mm_alloc(sizeof(struct cursor)); + cursor =3D (struct cursor *) mm_alloc(sizeof(struct cursor)); =20 - this->next =3D cur; - this->name =3D $2; - this->function =3D (current_function ? mm_strdup(current_function) : NUL= L); - this->connection =3D connection; - this->opened =3D false; - this->command =3D cat_str(7, mm_strdup("declare"), cursor_marker, $3, m= m_strdup("cursor"), $5, mm_strdup("for"), $7); - this->argsinsert =3D argsinsert; - this->argsinsert_oos =3D NULL; - this->argsresult =3D argsresult; - this->argsresult_oos =3D NULL; + cursor->next =3D cur; + cursor->name =3D $2; + cursor->function =3D (current_function ? mm_strdup(current_function) : N= ULL); + cursor->connection =3D connection; + cursor->opened =3D false; + cursor->command =3D cat_str(7, mm_strdup("declare"), cursor_marker, $3,= mm_strdup("cursor"), $5, mm_strdup("for"), $7); + cursor->argsinsert =3D argsinsert; + cursor->argsinsert_oos =3D NULL; + cursor->argsresult =3D argsresult; + cursor->argsresult_oos =3D NULL; argsinsert =3D argsresult =3D NULL; - cur =3D this; + cur =3D cursor; =20 - c1 =3D mm_strdup(this->command); + c1 =3D mm_strdup(cursor->command); if ((c2 =3D strstr(c1, "*/")) !=3D NULL) { /* We put this text into a comment, so we better remove [*][/]. */ @@ -328,11 +328,11 @@ ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optio= nsCURSORopt_holdFORSelectSt comment =3D cat_str(3, mm_strdup("/*"), c1, mm_strdup("*/")); =20 if ((braces_open > 0) && INFORMIX_MODE) /* we're in a function */ - $$ =3D cat_str(3, adjust_outofscope_cursor_vars(this), + $$ =3D cat_str(3, adjust_outofscope_cursor_vars(cursor), mm_strdup("ECPG_informix_reset_sqlca();"), comment); else - $$ =3D cat2_str(adjust_outofscope_cursor_vars(this), comment); + $$ =3D cat2_str(adjust_outofscope_cursor_vars(cursor), comment); } ECPG: ClosePortalStmtCLOSEcursor_name block { diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/prepr= oc/ecpg.c index aaecbf8122..19b41604b6 100644 --- a/src/interfaces/ecpg/preproc/ecpg.c +++ b/src/interfaces/ecpg/preproc/ecpg.c @@ -65,18 +65,18 @@ static void add_include_path(char *path) { struct _include_path *ip =3D include_paths, - *new; + *newpath; =20 - new =3D mm_alloc(sizeof(struct _include_path)); - new->path =3D path; - new->next =3D NULL; + newpath =3D mm_alloc(sizeof(struct _include_path)); + newpath->path =3D path; + newpath->next =3D NULL; =20 if (ip =3D=3D NULL) - include_paths =3D new; + include_paths =3D newpath; else { for (; ip->next !=3D NULL; ip =3D ip->next); - ip->next =3D new; + ip->next =3D newpath; } } =20 @@ -98,13 +98,13 @@ add_preprocessor_define(char *define) /* symbol has a value */ for (tmp =3D ptr - 1; *tmp =3D=3D ' '; tmp--); tmp[1] =3D '\0'; - defines->old =3D define_copy; - defines->new =3D ptr + 1; + defines->oldval =3D define_copy; + defines->newval =3D ptr + 1; } else { - defines->old =3D define_copy; - defines->new =3D mm_strdup("1"); + defines->oldval =3D define_copy; + defines->newval =3D mm_strdup("1"); } defines->pertinent =3D true; defines->used =3D NULL; @@ -345,7 +345,7 @@ main(int argc, char *const argv[]) /* remove old cursor definitions if any are still there */ for (ptr =3D cur; ptr !=3D NULL;) { - struct cursor *this =3D ptr; + struct cursor *c =3D ptr; struct arguments *l1, *l2; =20 @@ -363,7 +363,7 @@ main(int argc, char *const argv[]) free(l1); } ptr =3D ptr->next; - free(this); + free(c); } cur =3D NULL; =20 @@ -373,35 +373,35 @@ main(int argc, char *const argv[]) defptr =3D defines; defines =3D defines->next; =20 - free(defptr->new); - free(defptr->old); + free(defptr->newval); + free(defptr->oldval); free(defptr); } =20 for (defptr =3D defines; defptr !=3D NULL; defptr =3D defptr->next) { - struct _defines *this =3D defptr->next; + struct _defines *d =3D defptr->next; =20 - if (this && !this->pertinent) + if (d && !d->pertinent) { - defptr->next =3D this->next; + defptr->next =3D d->next; =20 - free(this->new); - free(this->old); - free(this); + free(d->newval); + free(d->oldval); + free(d); } } =20 /* and old typedefs */ for (typeptr =3D types; typeptr !=3D NULL;) { - struct typedefs *this =3D typeptr; + struct typedefs *td =3D typeptr; =20 free(typeptr->name); ECPGfree_struct_member(typeptr->struct_member_list); free(typeptr->type); typeptr =3D typeptr->next; - free(this); + free(td); } types =3D NULL; =20 diff --git a/src/interfaces/ecpg/preproc/ecpg.header b/src/interfaces/ecpg/= preproc/ecpg.header index 2562366bbe..151dbe6f10 100644 --- a/src/interfaces/ecpg/preproc/ecpg.header +++ b/src/interfaces/ecpg/preproc/ecpg.header @@ -528,7 +528,7 @@ add_typedef(char *name, char *dimension, char *length, = enum ECPGttype type_enum, char *type_dimension, char *type_index, int initializer, int array) { /* add entry to list */ - struct typedefs *ptr, *this; + struct typedefs *ptr, *td; =20 if ((type_enum =3D=3D ECPGt_struct || type_enum =3D=3D ECPGt_union) && @@ -546,29 +546,29 @@ add_typedef(char *name, char *dimension, char *length= , enum ECPGttype type_enum, } adjust_array(type_enum, &dimension, &length, type_dimension, type_index,= array, true); =20 - this =3D (struct typedefs *) mm_alloc(sizeof(struct typedefs)); + td =3D (struct typedefs *) mm_alloc(sizeof(struct typedefs)); =20 /* initial definition */ - this->next =3D types; - this->name =3D name; - this->brace_level =3D braces_open; - this->type =3D (struct this_type *) mm_alloc(sizeof(struct this_type)); - this->type->type_enum =3D type_enum; - this->type->type_str =3D mm_strdup(name); - this->type->type_dimension =3D dimension; /* dimension of array */ - this->type->type_index =3D length; /* length of string */ - this->type->type_sizeof =3D ECPGstruct_sizeof; - this->struct_member_list =3D (type_enum =3D=3D ECPGt_struct || type_enum= =3D=3D ECPGt_union) ? + td->next =3D types; + td->name =3D name; + td->brace_level =3D braces_open; + td->type =3D (struct this_type *) mm_alloc(sizeof(struct this_type)); + td->type->type_enum =3D type_enum; + td->type->type_str =3D mm_strdup(name); + td->type->type_dimension =3D dimension; /* dimension of array */ + td->type->type_index =3D length; /* length of string */ + td->type->type_sizeof =3D ECPGstruct_sizeof; + td->struct_member_list =3D (type_enum =3D=3D ECPGt_struct || type_enum = =3D=3D ECPGt_union) ? ECPGstruct_member_dup(struct_member_list[struct_level]) : NULL; =20 if (type_enum !=3D ECPGt_varchar && type_enum !=3D ECPGt_char && type_enum !=3D ECPGt_unsigned_char && type_enum !=3D ECPGt_string && - atoi(this->type->type_index) >=3D 0) + atoi(td->type->type_index) >=3D 0) mmerror(PARSE_ERROR, ET_ERROR, "multidimensional arrays for simple data= types are not supported"); =20 - types =3D this; + types =3D td; } } %} diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer b/src/interfaces/ecpg= /preproc/ecpg.trailer index 1c108795de..44971d9180 100644 --- a/src/interfaces/ecpg/preproc/ecpg.trailer +++ b/src/interfaces/ecpg/preproc/ecpg.trailer @@ -289,7 +289,7 @@ prepared_name: name */ ECPGCursorStmt: DECLARE cursor_name cursor_options CURSOR opt_hold FOR pr= epared_name { - struct cursor *ptr, *this; + struct cursor *ptr, *cursor; char *cursor_marker =3D $2[0] =3D=3D ':' ? mm_strdup("$0") : mm_strdup(= $2); int (* strcmp_fn)(const char *, const char *) =3D (($2[0] =3D=3D ':' ||= $2[0] =3D=3D '"') ? strcmp : pg_strcasecmp); struct variable *thisquery =3D (struct variable *)mm_alloc(sizeof(struc= t variable)); @@ -308,16 +308,16 @@ ECPGCursorStmt: DECLARE cursor_name cursor_options C= URSOR opt_hold FOR prepared } } =20 - this =3D (struct cursor *) mm_alloc(sizeof(struct cursor)); + cursor =3D (struct cursor *) mm_alloc(sizeof(struct cursor)); =20 /* initial definition */ - this->next =3D cur; - this->name =3D $2; - this->function =3D (current_function ? mm_strdup(current_function) : NU= LL); - this->connection =3D connection; - this->command =3D cat_str(6, mm_strdup("declare"), cursor_marker, $3, = mm_strdup("cursor"), $5, mm_strdup("for $1")); - this->argsresult =3D NULL; - this->argsresult_oos =3D NULL; + cursor->next =3D cur; + cursor->name =3D $2; + cursor->function =3D (current_function ? mm_strdup(current_function) : = NULL); + cursor->connection =3D connection; + cursor->command =3D cat_str(6, mm_strdup("declare"), cursor_marker, $3= , mm_strdup("cursor"), $5, mm_strdup("for $1")); + cursor->argsresult =3D NULL; + cursor->argsresult_oos =3D NULL; =20 thisquery->type =3D &ecpg_query; thisquery->brace_level =3D 0; @@ -325,26 +325,26 @@ ECPGCursorStmt: DECLARE cursor_name cursor_options C= URSOR opt_hold FOR prepared thisquery->name =3D (char *) mm_alloc(sizeof("ECPGprepared_statement(, = , __LINE__)") + strlen(con) + strlen($7)); sprintf(thisquery->name, "ECPGprepared_statement(%s, %s, __LINE__)", co= n, $7); =20 - this->argsinsert =3D NULL; - this->argsinsert_oos =3D NULL; + cursor->argsinsert =3D NULL; + cursor->argsinsert_oos =3D NULL; if ($2[0] =3D=3D ':') { struct variable *var =3D find_variable($2 + 1); remove_variable_from_list(&argsinsert, var); - add_variable_to_head(&(this->argsinsert), var, &no_indicator); + add_variable_to_head(&(cursor->argsinsert), var, &no_indicator); } - add_variable_to_head(&(this->argsinsert), thisquery, &no_indicator); + add_variable_to_head(&(cursor->argsinsert), thisquery, &no_indicator); =20 - cur =3D this; + cur =3D cursor; =20 - comment =3D cat_str(3, mm_strdup("/*"), mm_strdup(this->command), mm_st= rdup("*/")); + comment =3D cat_str(3, mm_strdup("/*"), mm_strdup(cursor->command), mm_= strdup("*/")); =20 if ((braces_open > 0) && INFORMIX_MODE) /* we're in a function */ - $$ =3D cat_str(3, adjust_outofscope_cursor_vars(this), + $$ =3D cat_str(3, adjust_outofscope_cursor_vars(cursor), mm_strdup("ECPG_informix_reset_sqlca();"), comment); else - $$ =3D cat2_str(adjust_outofscope_cursor_vars(this), comment); + $$ =3D cat2_str(adjust_outofscope_cursor_vars(cursor), comment); } ; =20 @@ -625,25 +625,25 @@ var_type: simple_type else { /* this is for typedef'ed types */ - struct typedefs *this =3D get_typedef($1); - - $$.type_str =3D (this->type->type_enum =3D=3D ECPGt_varchar) ? EMPTY := mm_strdup(this->name); - $$.type_enum =3D this->type->type_enum; - $$.type_dimension =3D this->type->type_dimension; - $$.type_index =3D this->type->type_index; - if (this->type->type_sizeof && strlen(this->type->type_sizeof) !=3D 0) - $$.type_sizeof =3D this->type->type_sizeof; + struct typedefs *td =3D get_typedef($1); + + $$.type_str =3D (td->type->type_enum =3D=3D ECPGt_varchar) ? EMPTY : m= m_strdup(td->name); + $$.type_enum =3D td->type->type_enum; + $$.type_dimension =3D td->type->type_dimension; + $$.type_index =3D td->type->type_index; + if (td->type->type_sizeof && strlen(td->type->type_sizeof) !=3D 0) + $$.type_sizeof =3D td->type->type_sizeof; else - $$.type_sizeof =3D cat_str(3, mm_strdup("sizeof("), mm_strdup(this->n= ame), mm_strdup(")")); + $$.type_sizeof =3D cat_str(3, mm_strdup("sizeof("), mm_strdup(td->nam= e), mm_strdup(")")); =20 - struct_member_list[struct_level] =3D ECPGstruct_member_dup(this->struc= t_member_list); + struct_member_list[struct_level] =3D ECPGstruct_member_dup(td->struct_= member_list); } } | s_struct_union_symbol { /* this is for named structs/unions */ char *name; - struct typedefs *this; + struct typedefs *td; bool forward =3D (forward_name !=3D NULL && strcmp($1.symbol, forward_n= ame) =3D=3D 0 && strcmp($1.su, "struct") =3D=3D 0); =20 name =3D cat2_str($1.su, $1.symbol); @@ -652,13 +652,13 @@ var_type: simple_type { /* No */ =20 - this =3D get_typedef(name); - $$.type_str =3D mm_strdup(this->name); - $$.type_enum =3D this->type->type_enum; - $$.type_dimension =3D this->type->type_dimension; - $$.type_index =3D this->type->type_index; - $$.type_sizeof =3D this->type->type_sizeof; - struct_member_list[struct_level] =3D ECPGstruct_member_dup(this->struc= t_member_list); + td =3D get_typedef(name); + $$.type_str =3D mm_strdup(td->name); + $$.type_enum =3D td->type->type_enum; + $$.type_dimension =3D td->type->type_dimension; + $$.type_index =3D td->type->type_index; + $$.type_sizeof =3D td->type->type_sizeof; + struct_member_list[struct_level] =3D ECPGstruct_member_dup(td->struct_= member_list); free(name); } else @@ -693,7 +693,7 @@ struct_union_type_with_symbol: s_struct_union_symbol } '{' variable_declarations '}' { - struct typedefs *ptr, *this; + struct typedefs *ptr, *td; struct this_type su_type; =20 ECPGfree_struct_member(struct_member_list[struct_level]); @@ -716,21 +716,21 @@ struct_union_type_with_symbol: s_struct_union_symbol mmerror(PARSE_ERROR, ET_ERROR, "type \"%s\" is already defined", su= _type.type_str); } =20 - this =3D (struct typedefs *) mm_alloc(sizeof(struct typedefs)); + td =3D (struct typedefs *) mm_alloc(sizeof(struct typedefs)); =20 /* initial definition */ - this->next =3D types; - this->name =3D mm_strdup(su_type.type_str); - this->brace_level =3D braces_open; - this->type =3D (struct this_type *) mm_alloc(sizeof(struct this_type)); - this->type->type_enum =3D su_type.type_enum; - this->type->type_str =3D mm_strdup(su_type.type_str); - this->type->type_dimension =3D mm_strdup("-1"); /* dimension of array */ - this->type->type_index =3D mm_strdup("-1"); /* length of string */ - this->type->type_sizeof =3D ECPGstruct_sizeof; - this->struct_member_list =3D struct_member_list[struct_level]; - - types =3D this; + td->next =3D types; + td->name =3D mm_strdup(su_type.type_str); + td->brace_level =3D braces_open; + td->type =3D (struct this_type *) mm_alloc(sizeof(struct this_type)); + td->type->type_enum =3D su_type.type_enum; + td->type->type_str =3D mm_strdup(su_type.type_str); + td->type->type_dimension =3D mm_strdup("-1"); /* dimension of array */ + td->type->type_index =3D mm_strdup("-1"); /* length of string */ + td->type->type_sizeof =3D ECPGstruct_sizeof; + td->struct_member_list =3D struct_member_list[struct_level]; + + types =3D td; $$ =3D cat_str(4, su_type.type_str, mm_strdup("{"), $4, mm_strdup("}")); } ; diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/prepro= c/pgc.l index 6b58dd5afe..eeabcd970a 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -954,14 +954,14 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifnde= f}|{import})((\/\*[^*/]*\*+ =20 for (ptr =3D defines; ptr !=3D NULL; ptr2 =3D ptr, ptr =3D ptr->next) { - if (strcmp(yytext, ptr->old) =3D=3D 0) + if (strcmp(yytext, ptr->oldval) =3D=3D 0) { if (ptr2 =3D=3D NULL) defines =3D ptr->next; else ptr2->next =3D ptr->next; - free(ptr->new); - free(ptr->old); + free(ptr->newval); + free(ptr->oldval); free(ptr); break; } @@ -1140,7 +1140,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifnde= f}|{import})((\/\*[^*/]*\*+ yytext[i+1] =3D '\0'; =20 for (defptr =3D defines; - defptr !=3D NULL && strcmp(yytext, defptr->old) !=3D 0; + defptr !=3D NULL && strcmp(yytext, defptr->oldval) !=3D 0; defptr =3D defptr->next); =20 preproc_tos++; @@ -1169,26 +1169,26 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifn= def}|{import})((\/\*[^*/]*\*+ yyterminate(); } {space}*";" { - struct _defines *ptr, *this; + struct _defines *ptr, *d; =20 for (ptr =3D defines; ptr !=3D NULL; ptr =3D ptr->next) { - if (strcmp(old, ptr->old) =3D=3D 0) + if (strcmp(old, ptr->oldval) =3D=3D 0) { - free(ptr->new); - ptr->new =3D mm_strdup(literalbuf); + free(ptr->newval); + ptr->newval =3D mm_strdup(literalbuf); } } if (ptr =3D=3D NULL) { - this =3D (struct _defines *) mm_alloc(sizeof(struct _defines)); + d =3D (struct _defines *) mm_alloc(sizeof(struct _defines)); =20 /* initial definition */ - this->old =3D old; - this->new =3D mm_strdup(literalbuf); - this->next =3D defines; - this->used =3D NULL; - defines =3D this; + d->oldval =3D old; + d->newval =3D mm_strdup(literalbuf); + d->next =3D defines; + d->used =3D NULL; + defines =3D d; } =20 BEGIN(C); @@ -1426,7 +1426,7 @@ static bool isdefine(void) /* is it a define? */ for (ptr =3D defines; ptr; ptr =3D ptr->next) { - if (strcmp(yytext, ptr->old) =3D=3D 0 && ptr->used =3D=3D NULL) + if (strcmp(yytext, ptr->oldval) =3D=3D 0 && ptr->used =3D=3D NULL) { struct _yy_buffer *yb; =20 @@ -1439,7 +1439,7 @@ static bool isdefine(void) =20 ptr->used =3D yy_buffer =3D yb; =20 - yy_scan_string(ptr->new); + yy_scan_string(ptr->newval); return true; } } @@ -1449,16 +1449,16 @@ static bool isdefine(void) =20 static bool isinformixdefine(void) { - const char *new =3D NULL; + const char *newstr =3D NULL; =20 if (strcmp(yytext, "dec_t") =3D=3D 0) - new =3D "decimal"; + newstr =3D "decimal"; else if (strcmp(yytext, "intrvl_t") =3D=3D 0) - new =3D "interval"; + newstr =3D "interval"; else if (strcmp(yytext, "dtime_t") =3D=3D 0) - new =3D "timestamp"; + newstr =3D "timestamp"; =20 - if (new) + if (newstr) { struct _yy_buffer *yb; =20 @@ -1470,7 +1470,7 @@ static bool isinformixdefine(void) yb->next =3D yy_buffer; yy_buffer =3D yb; =20 - yy_scan_string(new); + yy_scan_string(newstr); return true; } =20 diff --git a/src/interfaces/ecpg/preproc/type.c b/src/interfaces/ecpg/prepr= oc/type.c index 0b84b8d3c4..9e4455fb70 100644 --- a/src/interfaces/ecpg/preproc/type.c +++ b/src/interfaces/ecpg/preproc/type.c @@ -24,19 +24,19 @@ mm_alloc(size_t size) char * mm_strdup(const char *string) { - char *new =3D strdup(string); + char *newstr =3D strdup(string); =20 - if (new =3D=3D NULL) + if (newstr =3D=3D NULL) mmfatal(OUT_OF_MEMORY, "out of memory"); =20 - return new; + return newstr; } =20 /* duplicate memberlist */ struct ECPGstruct_member * ECPGstruct_member_dup(struct ECPGstruct_member * rm) { - struct ECPGstruct_member *new =3D NULL; + struct ECPGstruct_member *newval =3D NULL; =20 while (rm) { @@ -64,12 +64,12 @@ ECPGstruct_member_dup(struct ECPGstruct_member * rm) break; } =20 - ECPGmake_struct_member(rm->name, type, &new); + ECPGmake_struct_member(rm->name, type, &newval); =20 rm =3D rm->next; } =20 - return (new); + return (newval); } =20 /* The NAME argument is copied. The type argument is preserved as a pointe= r. */ diff --git a/src/interfaces/ecpg/preproc/type.h b/src/interfaces/ecpg/prepr= oc/type.h index cd0d1da8c4..3fadf35ba0 100644 --- a/src/interfaces/ecpg/preproc/type.h +++ b/src/interfaces/ecpg/preproc/type.h @@ -147,8 +147,8 @@ struct typedefs =20 struct _defines { - char *old; - char *new; + char *oldval; + char *newval; int pertinent; void *used; struct _defines *next; diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/p= reproc/variable.c index 232b940938..ccd3165123 100644 --- a/src/interfaces/ecpg/preproc/variable.c +++ b/src/interfaces/ecpg/preproc/variable.c @@ -391,18 +391,18 @@ void add_variable_to_tail(struct arguments ** list, struct variable * var, stru= ct variable * ind) { struct arguments *p, - *new =3D (struct arguments *) mm_alloc(sizeof(struct arguments)); + *newa =3D (struct arguments *) mm_alloc(sizeof(struct arguments)); =20 for (p =3D *list; p && p->next; p =3D p->next); =20 - new->variable =3D var; - new->indicator =3D ind; - new->next =3D NULL; + newa->variable =3D var; + newa->indicator =3D ind; + newa->next =3D NULL; =20 if (p) - p->next =3D new; + p->next =3D newa; else - *list =3D new; + *list =3D newa; } =20 void @@ -499,13 +499,13 @@ check_indicator(struct ECPGtype * var) struct typedefs * get_typedef(char *name) { - struct typedefs *this; + struct typedefs *td; =20 - for (this =3D types; this && strcmp(this->name, name) !=3D 0; this =3D th= is->next); - if (!this) + for (td =3D types; td && strcmp(td->name, name) !=3D 0; td =3D td->next); + if (!td) mmfatal(PARSE_ERROR, "unrecognized data type name \"%s\"", name); =20 - return (this); + return (td); } =20 void diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c index b25b3f1de0..4fa7ecd459 100644 --- a/src/pl/plpgsql/src/pl_comp.c +++ b/src/pl/plpgsql/src/pl_comp.c @@ -981,25 +981,25 @@ add_dummy_return(PLpgSQL_function *function) */ if (function->action->exceptions !=3D NULL) { - PLpgSQL_stmt_block *new; + PLpgSQL_stmt_block *newblock; =20 - new =3D palloc0(sizeof(PLpgSQL_stmt_block)); - new->cmd_type =3D PLPGSQL_STMT_BLOCK; - new->body =3D list_make1(function->action); + newblock =3D palloc0(sizeof(PLpgSQL_stmt_block)); + newblock->cmd_type =3D PLPGSQL_STMT_BLOCK; + newblock->body =3D list_make1(function->action); =20 - function->action =3D new; + function->action =3D newblock; } if (function->action->body =3D=3D NIL || ((PLpgSQL_stmt *) llast(function->action->body))->cmd_type !=3D PLPGSQL_= STMT_RETURN) { - PLpgSQL_stmt_return *new; + PLpgSQL_stmt_return *newstmt; =20 - new =3D palloc0(sizeof(PLpgSQL_stmt_return)); - new->cmd_type =3D PLPGSQL_STMT_RETURN; - new->expr =3D NULL; - new->retvarno =3D function->out_param_varno; + newstmt =3D palloc0(sizeof(PLpgSQL_stmt_return)); + newstmt->cmd_type =3D PLPGSQL_STMT_RETURN; + newstmt->expr =3D NULL; + newstmt->retvarno =3D function->out_param_varno; =20 - function->action->body =3D lappend(function->action->body, new); + function->action->body =3D lappend(function->action->body, newstmt); } } =20 @@ -1450,16 +1450,16 @@ plpgsql_parse_dblword(char *word1, char *word2, * datum whether it is or not --- any error will be * detected later. */ - PLpgSQL_recfield *new; + PLpgSQL_recfield *newfield; =20 - new =3D palloc(sizeof(PLpgSQL_recfield)); - new->dtype =3D PLPGSQL_DTYPE_RECFIELD; - new->fieldname =3D pstrdup(word2); - new->recparentno =3D ns->itemno; + newfield =3D palloc(sizeof(PLpgSQL_recfield)); + newfield->dtype =3D PLPGSQL_DTYPE_RECFIELD; + newfield->fieldname =3D pstrdup(word2); + newfield->recparentno =3D ns->itemno; =20 - plpgsql_adddatum((PLpgSQL_datum *) new); + plpgsql_adddatum((PLpgSQL_datum *) newfield); =20 - wdatum->datum =3D (PLpgSQL_datum *) new; + wdatum->datum =3D (PLpgSQL_datum *) newfield; } else { @@ -1561,16 +1561,16 @@ plpgsql_parse_tripword(char *word1, char *word2, ch= ar *word3, * words 1/2 are a record name, so third word could be * a field in this record. */ - PLpgSQL_recfield *new; + PLpgSQL_recfield *newfield; =20 - new =3D palloc(sizeof(PLpgSQL_recfield)); - new->dtype =3D PLPGSQL_DTYPE_RECFIELD; - new->fieldname =3D pstrdup(word3); - new->recparentno =3D ns->itemno; + newfield =3D palloc(sizeof(PLpgSQL_recfield)); + newfield->dtype =3D PLPGSQL_DTYPE_RECFIELD; + newfield->fieldname =3D pstrdup(word3); + newfield->recparentno =3D ns->itemno; =20 - plpgsql_adddatum((PLpgSQL_datum *) new); + plpgsql_adddatum((PLpgSQL_datum *) newfield); =20 - wdatum->datum =3D (PLpgSQL_datum *) new; + wdatum->datum =3D (PLpgSQL_datum *) newfield; wdatum->ident =3D NULL; wdatum->quoted =3D false; /* not used */ wdatum->idents =3D idents; @@ -2258,8 +2258,8 @@ PLpgSQL_condition * plpgsql_parse_err_condition(char *condname) { int i; - PLpgSQL_condition *new; - PLpgSQL_condition *prev; + PLpgSQL_condition *newcond; + PLpgSQL_condition *prevcond; =20 /* * XXX Eventually we will want to look for user-defined exception names @@ -2272,33 +2272,33 @@ plpgsql_parse_err_condition(char *condname) */ if (strcmp(condname, "others") =3D=3D 0) { - new =3D palloc(sizeof(PLpgSQL_condition)); - new->sqlerrstate =3D 0; - new->condname =3D condname; - new->next =3D NULL; - return new; + newcond =3D palloc(sizeof(PLpgSQL_condition)); + newcond->sqlerrstate =3D 0; + newcond->condname =3D condname; + newcond->next =3D NULL; + return newcond; } =20 - prev =3D NULL; + prevcond =3D NULL; for (i =3D 0; exception_label_map[i].label !=3D NULL; i++) { if (strcmp(condname, exception_label_map[i].label) =3D=3D 0) { - new =3D palloc(sizeof(PLpgSQL_condition)); - new->sqlerrstate =3D exception_label_map[i].sqlerrstate; - new->condname =3D condname; - new->next =3D prev; - prev =3D new; + newcond =3D palloc(sizeof(PLpgSQL_condition)); + newcond->sqlerrstate =3D exception_label_map[i].sqlerrstate; + newcond->condname =3D condname; + newcond->next =3D prevcond; + prevcond =3D newcond; } } =20 - if (!prev) + if (!prevcond) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("unrecognized exception condition \"%s\"", condname))); =20 - return prev; + return prevcond; } =20 /* ---------- @@ -2323,7 +2323,7 @@ plpgsql_start_datums(void) * ---------- */ void -plpgsql_adddatum(PLpgSQL_datum *new) +plpgsql_adddatum(PLpgSQL_datum *newdatum) { if (plpgsql_nDatums =3D=3D datums_alloc) { @@ -2331,8 +2331,8 @@ plpgsql_adddatum(PLpgSQL_datum *new) plpgsql_Datums =3D repalloc(plpgsql_Datums, sizeof(PLpgSQL_datum *) * da= tums_alloc); } =20 - new->dno =3D plpgsql_nDatums; - plpgsql_Datums[plpgsql_nDatums++] =3D new; + newdatum->dno =3D plpgsql_nDatums; + plpgsql_Datums[plpgsql_nDatums++] =3D newdatum; } =20 /* ---------- diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index 6fc3db07fe..7faad24d37 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -246,7 +246,7 @@ static void exec_assign_value(PLpgSQL_execstate *estate, Oid valtype, int32 valtypmod); static void exec_eval_datum(PLpgSQL_execstate *estate, PLpgSQL_datum *datum, - Oid *typeid, + Oid *typid, int32 *typetypmod, Datum *value, bool *isnull); @@ -1032,29 +1032,29 @@ copy_plpgsql_datum(PLpgSQL_datum *datum) { case PLPGSQL_DTYPE_VAR: { - PLpgSQL_var *new =3D palloc(sizeof(PLpgSQL_var)); + PLpgSQL_var *newvar =3D palloc(sizeof(PLpgSQL_var)); =20 - memcpy(new, datum, sizeof(PLpgSQL_var)); + memcpy(newvar, datum, sizeof(PLpgSQL_var)); /* should be preset to null/non-freeable */ - Assert(new->isnull); - Assert(!new->freeval); + Assert(newvar->isnull); + Assert(!newvar->freeval); =20 - result =3D (PLpgSQL_datum *) new; + result =3D (PLpgSQL_datum *) newvar; } break; =20 case PLPGSQL_DTYPE_REC: { - PLpgSQL_rec *new =3D palloc(sizeof(PLpgSQL_rec)); + PLpgSQL_rec *newrec =3D palloc(sizeof(PLpgSQL_rec)); =20 - memcpy(new, datum, sizeof(PLpgSQL_rec)); + memcpy(newrec, datum, sizeof(PLpgSQL_rec)); /* should be preset to null/non-freeable */ - Assert(new->tup =3D=3D NULL); - Assert(new->tupdesc =3D=3D NULL); - Assert(!new->freetup); - Assert(!new->freetupdesc); + Assert(newrec->tup =3D=3D NULL); + Assert(newrec->tupdesc =3D=3D NULL); + Assert(!newrec->freetup); + Assert(!newrec->freetupdesc); =20 - result =3D (PLpgSQL_datum *) new; + result =3D (PLpgSQL_datum *) newrec; } break; =20 @@ -3361,13 +3361,13 @@ exec_stmt_assert(PLpgSQL_execstate *estate, PLpgSQL= _stmt_assert *stmt) if (stmt->message !=3D NULL) { Datum val; - Oid typeid; + Oid typid; int32 typmod; =20 val =3D exec_eval_expr(estate, stmt->message, - &isnull, &typeid, &typmod); + &isnull, &typid, &typmod); if (!isnull) - message =3D convert_value_to_string(estate, val, typeid); + message =3D convert_value_to_string(estate, val, typid); /* we mustn't do exec_eval_cleanup here */ } =20 @@ -4823,7 +4823,7 @@ exec_assign_value(PLpgSQL_execstate *estate, static void exec_eval_datum(PLpgSQL_execstate *estate, PLpgSQL_datum *datum, - Oid *typeid, + Oid *typid, int32 *typetypmod, Datum *value, bool *isnull) @@ -4836,7 +4836,7 @@ exec_eval_datum(PLpgSQL_execstate *estate, { PLpgSQL_var *var =3D (PLpgSQL_var *) datum; =20 - *typeid =3D var->datatype->typoid; + *typid =3D var->datatype->typoid; *typetypmod =3D var->datatype->atttypmod; *value =3D var->value; *isnull =3D var->isnull; @@ -4856,7 +4856,7 @@ exec_eval_datum(PLpgSQL_execstate *estate, tup =3D make_tuple_from_row(estate, row, row->rowtupdesc); if (tup =3D=3D NULL) /* should not happen */ elog(ERROR, "row not compatible with its own tupdesc"); - *typeid =3D row->rowtupdesc->tdtypeid; + *typid =3D row->rowtupdesc->tdtypeid; *typetypmod =3D row->rowtupdesc->tdtypmod; *value =3D HeapTupleGetDatum(tup); *isnull =3D false; @@ -4879,7 +4879,7 @@ exec_eval_datum(PLpgSQL_execstate *estate, BlessTupleDesc(rec->tupdesc); =20 oldcontext =3D MemoryContextSwitchTo(get_eval_mcontext(estate)); - *typeid =3D rec->tupdesc->tdtypeid; + *typid =3D rec->tupdesc->tdtypeid; *typetypmod =3D rec->tupdesc->tdtypmod; *value =3D heap_copy_tuple_as_datum(rec->tup, rec->tupdesc); *isnull =3D false; @@ -4906,7 +4906,7 @@ exec_eval_datum(PLpgSQL_execstate *estate, (errcode(ERRCODE_UNDEFINED_COLUMN), errmsg("record \"%s\" has no field \"%s\"", rec->refname, recfield->fieldname))); - *typeid =3D SPI_gettypeid(rec->tupdesc, fno); + *typid =3D SPI_gettypeid(rec->tupdesc, fno); if (fno > 0) *typetypmod =3D rec->tupdesc->attrs[fno - 1]->atttypmod; else @@ -4932,7 +4932,7 @@ Oid plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate, PLpgSQL_datum *datum) { - Oid typeid; + Oid typid; =20 switch (datum->dtype) { @@ -4940,7 +4940,7 @@ plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate, { PLpgSQL_var *var =3D (PLpgSQL_var *) datum; =20 - typeid =3D var->datatype->typoid; + typid =3D var->datatype->typoid; break; } =20 @@ -4952,7 +4952,7 @@ plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate, elog(ERROR, "row variable has no tupdesc"); /* Make sure we have a valid type/typmod setting */ BlessTupleDesc(row->rowtupdesc); - typeid =3D row->rowtupdesc->tdtypeid; + typid =3D row->rowtupdesc->tdtypeid; break; } =20 @@ -4968,7 +4968,7 @@ plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate, errdetail("The tuple structure of a not-yet-assigned record is in= determinate."))); /* Make sure we have a valid type/typmod setting */ BlessTupleDesc(rec->tupdesc); - typeid =3D rec->tupdesc->tdtypeid; + typid =3D rec->tupdesc->tdtypeid; break; } =20 @@ -4991,17 +4991,17 @@ plpgsql_exec_get_datum_type(PLpgSQL_execstate *esta= te, (errcode(ERRCODE_UNDEFINED_COLUMN), errmsg("record \"%s\" has no field \"%s\"", rec->refname, recfield->fieldname))); - typeid =3D SPI_gettypeid(rec->tupdesc, fno); + typid =3D SPI_gettypeid(rec->tupdesc, fno); break; } =20 default: elog(ERROR, "unrecognized dtype: %d", datum->dtype); - typeid =3D InvalidOid; /* keep compiler quiet */ + typid =3D InvalidOid; /* keep compiler quiet */ break; } =20 - return typeid; + return typid; } =20 /* @@ -5013,7 +5013,7 @@ plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate, void plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate, PLpgSQL_datum *datum, - Oid *typeid, int32 *typmod, Oid *collation) + Oid *typid, int32 *typmod, Oid *collation) { switch (datum->dtype) { @@ -5021,7 +5021,7 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *e= state, { PLpgSQL_var *var =3D (PLpgSQL_var *) datum; =20 - *typeid =3D var->datatype->typoid; + *typid =3D var->datatype->typoid; *typmod =3D var->datatype->atttypmod; *collation =3D var->datatype->collation; break; @@ -5035,7 +5035,7 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *e= state, elog(ERROR, "row variable has no tupdesc"); /* Make sure we have a valid type/typmod setting */ BlessTupleDesc(row->rowtupdesc); - *typeid =3D row->rowtupdesc->tdtypeid; + *typid =3D row->rowtupdesc->tdtypeid; /* do NOT return the mutable typmod of a RECORD variable */ *typmod =3D -1; /* composite types are never collatable */ @@ -5055,7 +5055,7 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *e= state, errdetail("The tuple structure of a not-yet-assigned record is in= determinate."))); /* Make sure we have a valid type/typmod setting */ BlessTupleDesc(rec->tupdesc); - *typeid =3D rec->tupdesc->tdtypeid; + *typid =3D rec->tupdesc->tdtypeid; /* do NOT return the mutable typmod of a RECORD variable */ *typmod =3D -1; /* composite types are never collatable */ @@ -5082,7 +5082,7 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *e= state, (errcode(ERRCODE_UNDEFINED_COLUMN), errmsg("record \"%s\" has no field \"%s\"", rec->refname, recfield->fieldname))); - *typeid =3D SPI_gettypeid(rec->tupdesc, fno); + *typid =3D SPI_gettypeid(rec->tupdesc, fno); if (fno > 0) *typmod =3D rec->tupdesc->attrs[fno - 1]->atttypmod; else @@ -5096,7 +5096,7 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *e= state, =20 default: elog(ERROR, "unrecognized dtype: %d", datum->dtype); - *typeid =3D InvalidOid; /* keep compiler quiet */ + *typid =3D InvalidOid; /* keep compiler quiet */ *typmod =3D -1; *collation =3D InvalidOid; break; diff --git a/src/pl/plpgsql/src/pl_gram.y b/src/pl/plpgsql/src/pl_gram.y index 4a4cd6ae26..1c0f763870 100644 --- a/src/pl/plpgsql/src/pl_gram.y +++ b/src/pl/plpgsql/src/pl_gram.y @@ -400,22 +400,22 @@ opt_semi : =20 pl_block : decl_sect K_BEGIN proc_sect exception_sect K_END opt_label { - PLpgSQL_stmt_block *new; + PLpgSQL_stmt_block *newblock; =20 - new =3D palloc0(sizeof(PLpgSQL_stmt_block)); + newblock =3D palloc0(sizeof(PLpgSQL_stmt_block)); =20 - new->cmd_type =3D PLPGSQL_STMT_BLOCK; - new->lineno =3D plpgsql_location_to_lineno(@2); - new->label =3D $1.label; - new->n_initvars =3D $1.n_initvars; - new->initvarnos =3D $1.initvarnos; - new->body =3D $3; - new->exceptions =3D $4; + newblock->cmd_type =3D PLPGSQL_STMT_BLOCK; + newblock->lineno =3D plpgsql_location_to_lineno(@2); + newblock->label =3D $1.label; + newblock->n_initvars =3D $1.n_initvars; + newblock->initvarnos =3D $1.initvarnos; + newblock->body =3D $3; + newblock->exceptions =3D $4; =20 check_labels($1.label, $6, @6); plpgsql_ns_pop(); =20 - $$ =3D (PLpgSQL_stmt *)new; + $$ =3D (PLpgSQL_stmt *) newblock; } ; =20 @@ -542,7 +542,7 @@ decl_statement : decl_varname decl_const decl_datatype = decl_collate decl_notnull { plpgsql_ns_push($1.name, PLPGSQL_LABEL_OTHER); } decl_cursor_args decl_is_for decl_cursor_query { - PLpgSQL_var *new; + PLpgSQL_var *newvar; PLpgSQL_expr *curname_def; char buf[1024]; char *cp1; @@ -551,7 +551,7 @@ decl_statement : decl_varname decl_const decl_datatype = decl_collate decl_notnull /* pop local namespace for cursor args */ plpgsql_ns_pop(); =20 - new =3D (PLpgSQL_var *) + newvar =3D (PLpgSQL_var *) plpgsql_build_variable($1.name, $1.lineno, plpgsql_build_datatype(REFCURSOROID, -1, @@ -562,7 +562,7 @@ decl_statement : decl_varname decl_const decl_datatype = decl_collate decl_notnull =20 curname_def->dtype =3D PLPGSQL_DTYPE_EXPR; strcpy(buf, "SELECT "); - cp1 =3D new->refname; + cp1 =3D newvar->refname; cp2 =3D buf + strlen(buf); /* * Don't trust standard_conforming_strings here; @@ -579,14 +579,14 @@ decl_statement : decl_varname decl_const decl_datatyp= e decl_collate decl_notnull } strcpy(cp2, "'::pg_catalog.refcursor"); curname_def->query =3D pstrdup(buf); - new->default_val =3D curname_def; + newvar->default_val =3D curname_def; =20 - new->cursor_explicit_expr =3D $7; + newvar->cursor_explicit_expr =3D $7; if ($5 =3D=3D NULL) - new->cursor_explicit_argrow =3D -1; + newvar->cursor_explicit_argrow =3D -1; else - new->cursor_explicit_argrow =3D $5->dno; - new->cursor_options =3D CURSOR_OPT_FAST_PLAN | $2; + newvar->cursor_explicit_argrow =3D $5->dno; + newvar->cursor_options =3D CURSOR_OPT_FAST_PLAN | $2; } ; =20 @@ -616,30 +616,30 @@ decl_cursor_args : } | '(' decl_cursor_arglist ')' { - PLpgSQL_row *new; + PLpgSQL_row *newrow; int i; ListCell *l; =20 - new =3D palloc0(sizeof(PLpgSQL_row)); - new->dtype =3D PLPGSQL_DTYPE_ROW; - new->lineno =3D plpgsql_location_to_lineno(@1); - new->rowtupdesc =3D NULL; - new->nfields =3D list_length($2); - new->fieldnames =3D palloc(new->nfields * sizeof(char *)); - new->varnos =3D palloc(new->nfields * sizeof(int)); + newrow =3D palloc0(sizeof(PLpgSQL_row)); + newrow->dtype =3D PLPGSQL_DTYPE_ROW; + newrow->lineno =3D plpgsql_location_to_lineno(@1); + newrow->rowtupdesc =3D NULL; + newrow->nfields =3D list_length($2); + newrow->fieldnames =3D palloc(newrow->nfields * sizeof(char *)); + newrow->varnos =3D palloc(newrow->nfields * sizeof(int)); =20 i =3D 0; foreach (l, $2) { PLpgSQL_variable *arg =3D (PLpgSQL_variable *) lfirst(l); - new->fieldnames[i] =3D arg->refname; - new->varnos[i] =3D arg->dno; + newrow->fieldnames[i] =3D arg->refname; + newrow->varnos[i] =3D arg->dno; i++; } list_free($2); =20 - plpgsql_adddatum((PLpgSQL_datum *) new); - $$ =3D (PLpgSQL_datum *) new; + plpgsql_adddatum((PLpgSQL_datum *) newrow); + $$ =3D (PLpgSQL_datum *) newrow; } ; =20 @@ -900,46 +900,46 @@ proc_stmt : pl_block ';' =20 stmt_perform : K_PERFORM expr_until_semi { - PLpgSQL_stmt_perform *new; + PLpgSQL_stmt_perform *newstmt; =20 - new =3D palloc0(sizeof(PLpgSQL_stmt_perform)); - new->cmd_type =3D PLPGSQL_STMT_PERFORM; - new->lineno =3D plpgsql_location_to_lineno(@1); - new->expr =3D $2; + newstmt =3D palloc0(sizeof(PLpgSQL_stmt_perform)); + newstmt->cmd_type =3D PLPGSQL_STMT_PERFORM; + newstmt->lineno =3D plpgsql_location_to_lineno(@1); + newstmt->expr =3D $2; =20 - $$ =3D (PLpgSQL_stmt *)new; + $$ =3D (PLpgSQL_stmt *) newstmt; } ; =20 stmt_assign : assign_var assign_operator expr_until_semi { - PLpgSQL_stmt_assign *new; + PLpgSQL_stmt_assign *newstmt; =20 - new =3D palloc0(sizeof(PLpgSQL_stmt_assign)); - new->cmd_type =3D PLPGSQL_STMT_ASSIGN; - new->lineno =3D plpgsql_location_to_lineno(@1); - new->varno =3D $1->dno; - new->expr =3D $3; + newstmt =3D palloc0(sizeof(PLpgSQL_stmt_assign)); + newstmt->cmd_type =3D PLPGSQL_STMT_ASSIGN; + newstmt->lineno =3D plpgsql_location_to_lineno(@1); + newstmt->varno =3D $1->dno; + newstmt->expr =3D $3; =20 - $$ =3D (PLpgSQL_stmt *)new; + $$ =3D (PLpgSQL_stmt *) newstmt; } ; =20 stmt_getdiag : K_GET getdiag_area_opt K_DIAGNOSTICS getdiag_list ';' { - PLpgSQL_stmt_getdiag *new; + PLpgSQL_stmt_getdiag *newstmt; ListCell *lc; =20 - new =3D palloc0(sizeof(PLpgSQL_stmt_getdiag)); - new->cmd_type =3D PLPGSQL_STMT_GETDIAG; - new->lineno =3D plpgsql_location_to_lineno(@1); - new->is_stacked =3D $2; - new->diag_items =3D $4; + newstmt =3D palloc0(sizeof(PLpgSQL_stmt_getdiag)); + newstmt->cmd_type =3D PLPGSQL_STMT_GETDIAG; + newstmt->lineno =3D plpgsql_location_to_lineno(@1); + newstmt->is_stacked =3D $2; + newstmt->diag_items =3D $4; =20 /* * Check information items are valid for area option. */ - foreach(lc, new->diag_items) + foreach(lc, newstmt->diag_items) { PLpgSQL_diag_item *ditem =3D (PLpgSQL_diag_item *) lfirst(lc); =20 @@ -948,7 +948,7 @@ stmt_getdiag : K_GET getdiag_area_opt K_DIAGNOSTICS get= diag_list ';' /* these fields are disallowed in stacked case */ case PLPGSQL_GETDIAG_ROW_COUNT: case PLPGSQL_GETDIAG_RESULT_OID: - if (new->is_stacked) + if (newstmt->is_stacked) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("diagnostics item %s is not allowed in GET STACKED DIA= GNOSTICS", @@ -966,7 +966,7 @@ stmt_getdiag : K_GET getdiag_area_opt K_DIAGNOSTICS get= diag_list ';' case PLPGSQL_GETDIAG_MESSAGE_TEXT: case PLPGSQL_GETDIAG_TABLE_NAME: case PLPGSQL_GETDIAG_SCHEMA_NAME: - if (!new->is_stacked) + if (!newstmt->is_stacked) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("diagnostics item %s is not allowed in GET CURRENT DIA= GNOSTICS", @@ -983,7 +983,7 @@ stmt_getdiag : K_GET getdiag_area_opt K_DIAGNOSTICS get= diag_list ';' } } =20 - $$ =3D (PLpgSQL_stmt *)new; + $$ =3D (PLpgSQL_stmt *) newstmt; } ; =20 @@ -1013,13 +1013,13 @@ getdiag_list : getdiag_list ',' getdiag_list_item =20 getdiag_list_item : getdiag_target assign_operator getdiag_item { - PLpgSQL_diag_item *new; + PLpgSQL_diag_item *newitem; =20 - new =3D palloc(sizeof(PLpgSQL_diag_item)); - new->target =3D $1->dno; - new->kind =3D $3; + newitem =3D palloc(sizeof(PLpgSQL_diag_item)); + newitem->target =3D $1->dno; + newitem->kind =3D $3; =20 - $$ =3D new; + $$ =3D newitem; } ; =20 @@ -1102,34 +1102,34 @@ assign_var : T_DATUM } | assign_var '[' expr_until_rightbracket { - PLpgSQL_arrayelem *new; + PLpgSQL_arrayelem *newel; =20 - new =3D palloc0(sizeof(PLpgSQL_arrayelem)); - new->dtype =3D PLPGSQL_DTYPE_ARRAYELEM; - new->subscript =3D $3; - new->arrayparentno =3D $1->dno; + newel =3D palloc0(sizeof(PLpgSQL_arrayelem)); + newel->dtype =3D PLPGSQL_DTYPE_ARRAYELEM; + newel->subscript =3D $3; + newel->arrayparentno =3D $1->dno; /* initialize cached type data to "not valid" */ - new->parenttypoid =3D InvalidOid; + newel->parenttypoid =3D InvalidOid; =20 - plpgsql_adddatum((PLpgSQL_datum *) new); + plpgsql_adddatum((PLpgSQL_datum *) newel); =20 - $$ =3D (PLpgSQL_datum *) new; + $$ =3D (PLpgSQL_datum *) newel; } ; =20 stmt_if : K_IF expr_until_then proc_sect stmt_elsifs stmt_else K_END K_I= F ';' { - PLpgSQL_stmt_if *new; + PLpgSQL_stmt_if *newstmt; =20 - new =3D palloc0(sizeof(PLpgSQL_stmt_if)); - new->cmd_type =3D PLPGSQL_STMT_IF; - new->lineno =3D plpgsql_location_to_lineno(@1); - new->cond =3D $2; - new->then_body =3D $3; - new->elsif_list =3D $4; - new->else_body =3D $5; + newstmt =3D palloc0(sizeof(PLpgSQL_stmt_if)); + newstmt->cmd_type =3D PLPGSQL_STMT_IF; + newstmt->lineno =3D plpgsql_location_to_lineno(@1); + newstmt->cond =3D $2; + newstmt->then_body =3D $3; + newstmt->elsif_list =3D $4; + newstmt->else_body =3D $5; =20 - $$ =3D (PLpgSQL_stmt *)new; + $$ =3D (PLpgSQL_stmt *) newstmt; } ; =20 @@ -1139,14 +1139,14 @@ stmt_elsifs : } | stmt_elsifs K_ELSIF expr_until_then proc_sect { - PLpgSQL_if_elsif *new; + PLpgSQL_if_elsif *newstmt; =20 - new =3D palloc0(sizeof(PLpgSQL_if_elsif)); - new->lineno =3D plpgsql_location_to_lineno(@2); - new->cond =3D $3; - new->stmts =3D $4; + newstmt =3D palloc0(sizeof(PLpgSQL_if_elsif)); + newstmt->lineno =3D plpgsql_location_to_lineno(@2); + newstmt->cond =3D $3; + newstmt->stmts =3D $4; =20 - $$ =3D lappend($1, new); + $$ =3D lappend($1, newstmt); } ; =20 @@ -1193,12 +1193,12 @@ case_when_list : case_when_list case_when =20 case_when : K_WHEN expr_until_then proc_sect { - PLpgSQL_case_when *new =3D palloc(sizeof(PLpgSQL_case_when)); + PLpgSQL_case_when *newstmt =3D palloc(sizeof(PLpgSQL_case_when)); =20 - new->lineno =3D plpgsql_location_to_lineno(@1); - new->expr =3D $2; - new->stmts =3D $3; - $$ =3D new; + newstmt->lineno =3D plpgsql_location_to_lineno(@1); + newstmt->expr =3D $2; + newstmt->stmts =3D $3; + $$ =3D newstmt; } ; =20 @@ -1223,36 +1223,36 @@ opt_case_else : =20 stmt_loop : opt_loop_label K_LOOP loop_body { - PLpgSQL_stmt_loop *new; + PLpgSQL_stmt_loop *newstmt; =20 - new =3D palloc0(sizeof(PLpgSQL_stmt_loop)); - new->cmd_type =3D PLPGSQL_STMT_LOOP; - new->lineno =3D plpgsql_location_to_lineno(@2); - new->label =3D $1; - new->body =3D $3.stmts; + newstmt =3D palloc0(sizeof(PLpgSQL_stmt_loop)); + newstmt->cmd_type =3D PLPGSQL_STMT_LOOP; + newstmt->lineno =3D plpgsql_location_to_lineno(@2); + newstmt->label =3D $1; + newstmt->body =3D $3.stmts; =20 check_labels($1, $3.end_label, $3.end_label_location); plpgsql_ns_pop(); =20 - $$ =3D (PLpgSQL_stmt *)new; + $$ =3D (PLpgSQL_stmt *) newstmt; } ; =20 stmt_while : opt_loop_label K_WHILE expr_until_loop loop_body { - PLpgSQL_stmt_while *new; + PLpgSQL_stmt_while *newstmt; =20 - new =3D palloc0(sizeof(PLpgSQL_stmt_while)); - new->cmd_type =3D PLPGSQL_STMT_WHILE; - new->lineno =3D plpgsql_location_to_lineno(@2); - new->label =3D $1; - new->cond =3D $3; - new->body =3D $4.stmts; + newstmt =3D palloc0(sizeof(PLpgSQL_stmt_while)); + newstmt->cmd_type =3D PLPGSQL_STMT_WHILE; + newstmt->lineno =3D plpgsql_location_to_lineno(@2); + newstmt->label =3D $1; + newstmt->cond =3D $3; + newstmt->body =3D $4.stmts; =20 check_labels($1, $4.end_label, $4.end_label_location); plpgsql_ns_pop(); =20 - $$ =3D (PLpgSQL_stmt *)new; + $$ =3D (PLpgSQL_stmt *) newstmt; } ; =20 @@ -1261,27 +1261,27 @@ stmt_for : opt_loop_label K_FOR for_control loop_b= ody /* This runs after we've scanned the loop body */ if ($3->cmd_type =3D=3D PLPGSQL_STMT_FORI) { - PLpgSQL_stmt_fori *new; + PLpgSQL_stmt_fori *newstmt; =20 - new =3D (PLpgSQL_stmt_fori *) $3; - new->lineno =3D plpgsql_location_to_lineno(@2); - new->label =3D $1; - new->body =3D $4.stmts; - $$ =3D (PLpgSQL_stmt *) new; + newstmt =3D (PLpgSQL_stmt_fori *) $3; + newstmt->lineno =3D plpgsql_location_to_lineno(@2); + newstmt->label =3D $1; + newstmt->body =3D $4.stmts; + $$ =3D (PLpgSQL_stmt *) newstmt; } else { - PLpgSQL_stmt_forq *new; + PLpgSQL_stmt_forq *newstmt; =20 Assert($3->cmd_type =3D=3D PLPGSQL_STMT_FORS || $3->cmd_type =3D=3D PLPGSQL_STMT_FORC || $3->cmd_type =3D=3D PLPGSQL_STMT_DYNFORS); /* forq is the common supertype of all three */ - new =3D (PLpgSQL_stmt_forq *) $3; - new->lineno =3D plpgsql_location_to_lineno(@2); - new->label =3D $1; - new->body =3D $4.stmts; - $$ =3D (PLpgSQL_stmt *) new; + newstmt =3D (PLpgSQL_stmt_forq *) $3; + newstmt->lineno =3D plpgsql_location_to_lineno(@2); + newstmt->label =3D $1; + newstmt->body =3D $4.stmts; + $$ =3D (PLpgSQL_stmt *) newstmt; } =20 check_labels($1, $4.end_label, $4.end_label_location); @@ -1298,7 +1298,7 @@ for_control : for_variable K_IN if (tok =3D=3D K_EXECUTE) { /* EXECUTE means it's a dynamic FOR loop */ - PLpgSQL_stmt_dynfors *new; + PLpgSQL_stmt_dynfors *newstmt; PLpgSQL_expr *expr; int term; =20 @@ -1306,22 +1306,22 @@ for_control : for_variable K_IN "LOOP or USING", &term); =20 - new =3D palloc0(sizeof(PLpgSQL_stmt_dynfors)); - new->cmd_type =3D PLPGSQL_STMT_DYNFORS; + newstmt =3D palloc0(sizeof(PLpgSQL_stmt_dynfors)); + newstmt->cmd_type =3D PLPGSQL_STMT_DYNFORS; if ($1.rec) { - new->rec =3D $1.rec; - check_assignable((PLpgSQL_datum *) new->rec, @1); + newstmt->rec =3D $1.rec; + check_assignable((PLpgSQL_datum *) newstmt->rec, @1); } else if ($1.row) { - new->row =3D $1.row; - check_assignable((PLpgSQL_datum *) new->row, @1); + newstmt->row =3D $1.row; + check_assignable((PLpgSQL_datum *) newstmt->row, @1); } else if ($1.scalar) { /* convert single scalar to list */ - new->row =3D make_scalar_list1($1.name, $1.scalar, + newstmt->row =3D make_scalar_list1($1.name, $1.scalar, $1.lineno, @1); /* no need for check_assignable */ } @@ -1332,7 +1332,7 @@ for_control : for_variable K_IN errmsg("loop variable of loop over rows must be a record or row= variable or list of scalar variables"), parser_errposition(@1))); } - new->query =3D expr; + newstmt->query =3D expr; =20 if (term =3D=3D K_USING) { @@ -1341,23 +1341,23 @@ for_control : for_variable K_IN expr =3D read_sql_expression2(',', K_LOOP, ", or LOOP", &term); - new->params =3D lappend(new->params, expr); + newstmt->params =3D lappend(newstmt->params, expr); } while (term =3D=3D ','); } =20 - $$ =3D (PLpgSQL_stmt *) new; + $$ =3D (PLpgSQL_stmt *) newstmt; } else if (tok =3D=3D T_DATUM && yylval.wdatum.datum->dtype =3D=3D PLPGSQL_DTYPE_VAR && ((PLpgSQL_var *) yylval.wdatum.datum)->datatype->typoid =3D=3D RE= FCURSOROID) { /* It's FOR var IN cursor */ - PLpgSQL_stmt_forc *new; + PLpgSQL_stmt_forc *newstmt; PLpgSQL_var *cursor =3D (PLpgSQL_var *) yylval.wdatum.datum; =20 - new =3D (PLpgSQL_stmt_forc *) palloc0(sizeof(PLpgSQL_stmt_forc)); - new->cmd_type =3D PLPGSQL_STMT_FORC; - new->curvar =3D cursor->dno; + newstmt =3D (PLpgSQL_stmt_forc *) palloc0(sizeof(PLpgSQL_stmt_forc)= ); + newstmt->cmd_type =3D PLPGSQL_STMT_FORC; + newstmt->curvar =3D cursor->dno; =20 /* Should have had a single variable name */ if ($1.scalar && $1.row) @@ -1374,16 +1374,16 @@ for_control : for_variable K_IN parser_errposition(tokloc))); =20 /* collect cursor's parameters if any */ - new->argquery =3D read_cursor_args(cursor, + newstmt->argquery =3D read_cursor_args(cursor, K_LOOP, "LOOP"); =20 /* create loop's private RECORD variable */ - new->rec =3D plpgsql_build_record($1.name, + newstmt->rec =3D plpgsql_build_record($1.name, $1.lineno, true); =20 - $$ =3D (PLpgSQL_stmt *) new; + $$ =3D (PLpgSQL_stmt *) newstmt; } else { @@ -1433,7 +1433,7 @@ for_control : for_variable K_IN PLpgSQL_expr *expr2; PLpgSQL_expr *expr_by; PLpgSQL_var *fvar; - PLpgSQL_stmt_fori *new; + PLpgSQL_stmt_fori *newstmt; =20 /* Check first expression is well-formed */ check_sql_expr(expr1->query, expr1loc, 7); @@ -1466,15 +1466,15 @@ for_control : for_variable K_IN InvalidOid), true); =20 - new =3D palloc0(sizeof(PLpgSQL_stmt_fori)); - new->cmd_type =3D PLPGSQL_STMT_FORI; - new->var =3D fvar; - new->reverse =3D reverse; - new->lower =3D expr1; - new->upper =3D expr2; - new->step =3D expr_by; + newstmt =3D palloc0(sizeof(PLpgSQL_stmt_fori)); + newstmt->cmd_type =3D PLPGSQL_STMT_FORI; + newstmt->var =3D fvar; + newstmt->reverse =3D reverse; + newstmt->lower =3D expr1; + newstmt->upper =3D expr2; + newstmt->step =3D expr_by; =20 - $$ =3D (PLpgSQL_stmt *) new; + $$ =3D (PLpgSQL_stmt *) newstmt; } else { @@ -1485,7 +1485,7 @@ for_control : for_variable K_IN * syntax checking. */ char *tmp_query; - PLpgSQL_stmt_fors *new; + PLpgSQL_stmt_fors *newstmt; =20 if (reverse) ereport(ERROR, @@ -1500,22 +1500,22 @@ for_control : for_variable K_IN =20 check_sql_expr(expr1->query, expr1loc, 0); =20 - new =3D palloc0(sizeof(PLpgSQL_stmt_fors)); - new->cmd_type =3D PLPGSQL_STMT_FORS; + newstmt =3D palloc0(sizeof(PLpgSQL_stmt_fors)); + newstmt->cmd_type =3D PLPGSQL_STMT_FORS; if ($1.rec) { - new->rec =3D $1.rec; - check_assignable((PLpgSQL_datum *) new->rec, @1); + newstmt->rec =3D $1.rec; + check_assignable((PLpgSQL_datum *) newstmt->rec, @1); } else if ($1.row) { - new->row =3D $1.row; - check_assignable((PLpgSQL_datum *) new->row, @1); + newstmt->row =3D $1.row; + check_assignable((PLpgSQL_datum *) newstmt->row, @1); } else if ($1.scalar) { /* convert single scalar to list */ - new->row =3D make_scalar_list1($1.name, $1.scalar, + newstmt->row =3D make_scalar_list1($1.name, $1.scalar, $1.lineno, @1); /* no need for check_assignable */ } @@ -1527,8 +1527,8 @@ for_control : for_variable K_IN parser_errposition(@1))); } =20 - new->query =3D expr1; - $$ =3D (PLpgSQL_stmt *) new; + newstmt->query =3D expr1; + $$ =3D (PLpgSQL_stmt *) newstmt; } } } @@ -1608,29 +1608,29 @@ for_variable : T_DATUM =20 stmt_foreach_a : opt_loop_label K_FOREACH for_variable foreach_slice K_IN = K_ARRAY expr_until_loop loop_body { - PLpgSQL_stmt_foreach_a *new; + PLpgSQL_stmt_foreach_a *newstmt; =20 - new =3D palloc0(sizeof(PLpgSQL_stmt_foreach_a)); - new->cmd_type =3D PLPGSQL_STMT_FOREACH_A; - new->lineno =3D plpgsql_location_to_lineno(@2); - new->label =3D $1; - new->slice =3D $4; - new->expr =3D $7; - new->body =3D $8.stmts; + newstmt =3D palloc0(sizeof(PLpgSQL_stmt_foreach_a)); + newstmt->cmd_type =3D PLPGSQL_STMT_FOREACH_A; + newstmt->lineno =3D plpgsql_location_to_lineno(@2); + newstmt->label =3D $1; + newstmt->slice =3D $4; + newstmt->expr =3D $7; + newstmt->body =3D $8.stmts; =20 if ($3.rec) { - new->varno =3D $3.rec->dno; + newstmt->varno =3D $3.rec->dno; check_assignable((PLpgSQL_datum *) $3.rec, @3); } else if ($3.row) { - new->varno =3D $3.row->dno; + newstmt->varno =3D $3.row->dno; check_assignable((PLpgSQL_datum *) $3.row, @3); } else if ($3.scalar) { - new->varno =3D $3.scalar->dno; + newstmt->varno =3D $3.scalar->dno; check_assignable($3.scalar, @3); } else @@ -1644,7 +1644,7 @@ stmt_foreach_a : opt_loop_label K_FOREACH for_variabl= e foreach_slice K_IN K_ARRA check_labels($1, $8.end_label, $8.end_label_location); plpgsql_ns_pop(); =20 - $$ =3D (PLpgSQL_stmt *) new; + $$ =3D (PLpgSQL_stmt *) newstmt; } ; =20 @@ -1660,14 +1660,14 @@ foreach_slice : =20 stmt_exit : exit_type opt_label opt_exitcond { - PLpgSQL_stmt_exit *new; + PLpgSQL_stmt_exit *newstmt; =20 - new =3D palloc0(sizeof(PLpgSQL_stmt_exit)); - new->cmd_type =3D PLPGSQL_STMT_EXIT; - new->is_exit =3D $1; - new->lineno =3D plpgsql_location_to_lineno(@1); - new->label =3D $2; - new->cond =3D $3; + newstmt =3D palloc0(sizeof(PLpgSQL_stmt_exit)); + newstmt->cmd_type =3D PLPGSQL_STMT_EXIT; + newstmt->is_exit =3D $1; + newstmt->lineno =3D plpgsql_location_to_lineno(@1); + newstmt->label =3D $2; + newstmt->cond =3D $3; =20 if ($2) { @@ -1683,7 +1683,7 @@ stmt_exit : exit_type opt_label opt_exitcond $2), parser_errposition(@2))); /* CONTINUE only allows loop labels */ - if (label->itemno !=3D PLPGSQL_LABEL_LOOP && !new->is_exit) + if (label->itemno !=3D PLPGSQL_LABEL_LOOP && !newstmt->is_exit) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("block label \"%s\" cannot be used in CONTINUE", @@ -1700,13 +1700,13 @@ stmt_exit : exit_type opt_label opt_exitcond if (plpgsql_ns_find_nearest_loop(plpgsql_ns_top()) =3D=3D NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - new->is_exit ? + newstmt->is_exit ? errmsg("EXIT cannot be used outside a loop, unless it has a lab= el") : errmsg("CONTINUE cannot be used outside a loop"), parser_errposition(@1))); } =20 - $$ =3D (PLpgSQL_stmt *)new; + $$ =3D (PLpgSQL_stmt *) newstmt; } ; =20 @@ -1748,18 +1748,18 @@ stmt_return : K_RETURN =20 stmt_raise : K_RAISE { - PLpgSQL_stmt_raise *new; + PLpgSQL_stmt_raise *newstmt; int tok; =20 - new =3D palloc(sizeof(PLpgSQL_stmt_raise)); + newstmt =3D palloc(sizeof(PLpgSQL_stmt_raise)); =20 - new->cmd_type =3D PLPGSQL_STMT_RAISE; - new->lineno =3D plpgsql_location_to_lineno(@1); - new->elog_level =3D ERROR; /* default */ - new->condname =3D NULL; - new->message =3D NULL; - new->params =3D NIL; - new->options =3D NIL; + newstmt->cmd_type =3D PLPGSQL_STMT_RAISE; + newstmt->lineno =3D plpgsql_location_to_lineno(@1); + newstmt->elog_level =3D ERROR; /* default */ + newstmt->condname =3D NULL; + newstmt->message =3D NULL; + newstmt->params =3D NIL; + newstmt->options =3D NIL; =20 tok =3D yylex(); if (tok =3D=3D 0) @@ -1777,37 +1777,37 @@ stmt_raise : K_RAISE if (tok_is_keyword(tok, &yylval, K_EXCEPTION, "exception")) { - new->elog_level =3D ERROR; + newstmt->elog_level =3D ERROR; tok =3D yylex(); } else if (tok_is_keyword(tok, &yylval, K_WARNING, "warning")) { - new->elog_level =3D WARNING; + newstmt->elog_level =3D WARNING; tok =3D yylex(); } else if (tok_is_keyword(tok, &yylval, K_NOTICE, "notice")) { - new->elog_level =3D NOTICE; + newstmt->elog_level =3D NOTICE; tok =3D yylex(); } else if (tok_is_keyword(tok, &yylval, K_INFO, "info")) { - new->elog_level =3D INFO; + newstmt->elog_level =3D INFO; tok =3D yylex(); } else if (tok_is_keyword(tok, &yylval, K_LOG, "log")) { - new->elog_level =3D LOG; + newstmt->elog_level =3D LOG; tok =3D yylex(); } else if (tok_is_keyword(tok, &yylval, K_DEBUG, "debug")) { - new->elog_level =3D DEBUG1; + newstmt->elog_level =3D DEBUG1; tok =3D yylex(); } if (tok =3D=3D 0) @@ -1822,7 +1822,7 @@ stmt_raise : K_RAISE if (tok =3D=3D SCONST) { /* old style message and parameters */ - new->message =3D yylval.str; + newstmt->message =3D yylval.str; /* * We expect either a semi-colon, which * indicates no parameters, or a comma that @@ -1842,7 +1842,7 @@ stmt_raise : K_RAISE "SELECT ", true, true, true, NULL, &tok); - new->params =3D lappend(new->params, expr); + newstmt->params =3D lappend(newstmt->params, expr); } } else if (tok !=3D K_USING) @@ -1862,17 +1862,17 @@ stmt_raise : K_RAISE yyerror("invalid SQLSTATE code"); if (strspn(sqlstatestr, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ") != =3D 5) yyerror("invalid SQLSTATE code"); - new->condname =3D sqlstatestr; + newstmt->condname =3D sqlstatestr; } else { if (tok =3D=3D T_WORD) - new->condname =3D yylval.word.ident; + newstmt->condname =3D yylval.word.ident; else if (plpgsql_token_is_unreserved_keyword(tok)) - new->condname =3D pstrdup(yylval.keyword); + newstmt->condname =3D pstrdup(yylval.keyword); else yyerror("syntax error"); - plpgsql_recognize_err_condition(new->condname, + plpgsql_recognize_err_condition(newstmt->condname, false); } tok =3D yylex(); @@ -1881,35 +1881,35 @@ stmt_raise : K_RAISE } =20 if (tok =3D=3D K_USING) - new->options =3D read_raise_options(); + newstmt->options =3D read_raise_options(); } =20 - check_raise_parameters(new); + check_raise_parameters(newstmt); =20 - $$ =3D (PLpgSQL_stmt *)new; + $$ =3D (PLpgSQL_stmt *) newstmt; } ; =20 stmt_assert : K_ASSERT { - PLpgSQL_stmt_assert *new; + PLpgSQL_stmt_assert *newstmt; int tok; =20 - new =3D palloc(sizeof(PLpgSQL_stmt_assert)); + newstmt =3D palloc(sizeof(PLpgSQL_stmt_assert)); =20 - new->cmd_type =3D PLPGSQL_STMT_ASSERT; - new->lineno =3D plpgsql_location_to_lineno(@1); + newstmt->cmd_type =3D PLPGSQL_STMT_ASSERT; + newstmt->lineno =3D plpgsql_location_to_lineno(@1); =20 - new->cond =3D read_sql_expression2(',', ';', + newstmt->cond =3D read_sql_expression2(',', ';', ", or ;", &tok); =20 if (tok =3D=3D ',') - new->message =3D read_sql_expression(';', ";"); + newstmt->message =3D read_sql_expression(';', ";"); else - new->message =3D NULL; + newstmt->message =3D NULL; =20 - $$ =3D (PLpgSQL_stmt *) new; + $$ =3D (PLpgSQL_stmt *) newstmt; } ; =20 @@ -1963,7 +1963,7 @@ stmt_execsql : K_IMPORT =20 stmt_dynexecute : K_EXECUTE { - PLpgSQL_stmt_dynexecute *new; + PLpgSQL_stmt_dynexecute *newstmt; PLpgSQL_expr *expr; int endtoken; =20 @@ -1973,15 +1973,15 @@ stmt_dynexecute : K_EXECUTE true, true, true, NULL, &endtoken); =20 - new =3D palloc(sizeof(PLpgSQL_stmt_dynexecute)); - new->cmd_type =3D PLPGSQL_STMT_DYNEXECUTE; - new->lineno =3D plpgsql_location_to_lineno(@1); - new->query =3D expr; - new->into =3D false; - new->strict =3D false; - new->rec =3D NULL; - new->row =3D NULL; - new->params =3D NIL; + newstmt =3D palloc(sizeof(PLpgSQL_stmt_dynexecute)); + newstmt->cmd_type =3D PLPGSQL_STMT_DYNEXECUTE; + newstmt->lineno =3D plpgsql_location_to_lineno(@1); + newstmt->query =3D expr; + newstmt->into =3D false; + newstmt->strict =3D false; + newstmt->rec =3D NULL; + newstmt->row =3D NULL; + newstmt->params =3D NIL; =20 /* * We loop to allow the INTO and USING clauses to @@ -1994,15 +1994,15 @@ stmt_dynexecute : K_EXECUTE { if (endtoken =3D=3D K_INTO) { - if (new->into) /* multiple INTO */ + if (newstmt->into) /* multiple INTO */ yyerror("syntax error"); - new->into =3D true; - read_into_target(&new->rec, &new->row, &new->strict); + newstmt->into =3D true; + read_into_target(&newstmt->rec, &newstmt->row, &newstmt->strict); endtoken =3D yylex(); } else if (endtoken =3D=3D K_USING) { - if (new->params) /* multiple USING */ + if (newstmt->params) /* multiple USING */ yyerror("syntax error"); do { @@ -2011,7 +2011,7 @@ stmt_dynexecute : K_EXECUTE "SELECT ", true, true, true, NULL, &endtoken); - new->params =3D lappend(new->params, expr); + newstmt->params =3D lappend(newstmt->params, expr); } while (endtoken =3D=3D ','); } else if (endtoken =3D=3D ';') @@ -2020,21 +2020,21 @@ stmt_dynexecute : K_EXECUTE yyerror("syntax error"); } =20 - $$ =3D (PLpgSQL_stmt *)new; + $$ =3D (PLpgSQL_stmt *) newstmt; } ; =20 =20 stmt_open : K_OPEN cursor_variable { - PLpgSQL_stmt_open *new; + PLpgSQL_stmt_open *newstmt; int tok; =20 - new =3D palloc0(sizeof(PLpgSQL_stmt_open)); - new->cmd_type =3D PLPGSQL_STMT_OPEN; - new->lineno =3D plpgsql_location_to_lineno(@1); - new->curvar =3D $2->dno; - new->cursor_options =3D CURSOR_OPT_FAST_PLAN; + newstmt =3D palloc0(sizeof(PLpgSQL_stmt_open)); + newstmt->cmd_type =3D PLPGSQL_STMT_OPEN; + newstmt->lineno =3D plpgsql_location_to_lineno(@1); + newstmt->curvar =3D $2->dno; + newstmt->cursor_options =3D CURSOR_OPT_FAST_PLAN; =20 if ($2->cursor_explicit_expr =3D=3D NULL) { @@ -2047,14 +2047,14 @@ stmt_open : K_OPEN cursor_variable if (tok_is_keyword(tok, &yylval, K_SCROLL, "scroll")) { - new->cursor_options |=3D CURSOR_OPT_NO_SCROLL; + newstmt->cursor_options |=3D CURSOR_OPT_NO_SCROLL; tok =3D yylex(); } } else if (tok_is_keyword(tok, &yylval, K_SCROLL, "scroll")) { - new->cursor_options |=3D CURSOR_OPT_SCROLL; + newstmt->cursor_options |=3D CURSOR_OPT_SCROLL; tok =3D yylex(); } =20 @@ -2066,7 +2066,7 @@ stmt_open : K_OPEN cursor_variable { int endtoken; =20 - new->dynquery =3D + newstmt->dynquery =3D read_sql_expression2(K_USING, ';', "USING or ;", &endtoken); @@ -2081,7 +2081,7 @@ stmt_open : K_OPEN cursor_variable expr =3D read_sql_expression2(',', ';', ", or ;", &endtoken); - new->params =3D lappend(new->params, + newstmt->params =3D lappend(newstmt->params, expr); } while (endtoken =3D=3D ','); } @@ -2089,16 +2089,16 @@ stmt_open : K_OPEN cursor_variable else { plpgsql_push_back_token(tok); - new->query =3D read_sql_stmt(""); + newstmt->query =3D read_sql_stmt(""); } } else { /* predefined cursor query, so read args */ - new->argquery =3D read_cursor_args($2, ';', ";"); + newstmt->argquery =3D read_cursor_args($2, ';', ";"); } =20 - $$ =3D (PLpgSQL_stmt *)new; + $$ =3D (PLpgSQL_stmt *) newstmt; } ; =20 @@ -2154,14 +2154,14 @@ opt_fetch_direction : =20 stmt_close : K_CLOSE cursor_variable ';' { - PLpgSQL_stmt_close *new; + PLpgSQL_stmt_close *newstmt; =20 - new =3D palloc(sizeof(PLpgSQL_stmt_close)); - new->cmd_type =3D PLPGSQL_STMT_CLOSE; - new->lineno =3D plpgsql_location_to_lineno(@1); - new->curvar =3D $2->dno; + newstmt =3D palloc(sizeof(PLpgSQL_stmt_close)); + newstmt->cmd_type =3D PLPGSQL_STMT_CLOSE; + newstmt->lineno =3D plpgsql_location_to_lineno(@1); + newstmt->curvar =3D $2->dno; =20 - $$ =3D (PLpgSQL_stmt *)new; + $$ =3D (PLpgSQL_stmt *) newstmt; } ; =20 @@ -2218,7 +2218,7 @@ exception_sect : * current block. */ int lineno =3D plpgsql_location_to_lineno(@1); - PLpgSQL_exception_block *new =3D palloc(sizeof(PLpgSQL_exception_blo= ck)); + PLpgSQL_exception_block *newblock =3D palloc(sizeof(PLpgSQL_exceptio= n_block)); PLpgSQL_variable *var; =20 var =3D plpgsql_build_variable("sqlstate", lineno, @@ -2227,7 +2227,7 @@ exception_sect : plpgsql_curr_compile->fn_input_collation), true); ((PLpgSQL_var *) var)->isconst =3D true; - new->sqlstate_varno =3D var->dno; + newblock->sqlstate_varno =3D var->dno; =20 var =3D plpgsql_build_variable("sqlerrm", lineno, plpgsql_build_datatype(TEXTOID, @@ -2235,16 +2235,16 @@ exception_sect : plpgsql_curr_compile->fn_input_collation), true); ((PLpgSQL_var *) var)->isconst =3D true; - new->sqlerrm_varno =3D var->dno; + newblock->sqlerrm_varno =3D var->dno; =20 - $$ =3D new; + $$ =3D newblock; } proc_exceptions { - PLpgSQL_exception_block *new =3D $2; - new->exc_list =3D $3; + PLpgSQL_exception_block *newblock =3D $2; + newblock->exc_list =3D $3; =20 - $$ =3D new; + $$ =3D newblock; } ; =20 @@ -2260,14 +2260,14 @@ proc_exceptions : proc_exceptions proc_exception =20 proc_exception : K_WHEN proc_conditions K_THEN proc_sect { - PLpgSQL_exception *new; + PLpgSQL_exception *newx; =20 - new =3D palloc0(sizeof(PLpgSQL_exception)); - new->lineno =3D plpgsql_location_to_lineno(@1); - new->conditions =3D $2; - new->action =3D $4; + newx =3D palloc0(sizeof(PLpgSQL_exception)); + newx->lineno =3D plpgsql_location_to_lineno(@1); + newx->conditions =3D $2; + newx->action =3D $4; =20 - $$ =3D new; + $$ =3D newx; } ; =20 @@ -2294,7 +2294,7 @@ proc_condition : any_identifier } else { - PLpgSQL_condition *new; + PLpgSQL_condition *newc; char *sqlstatestr; =20 /* next token should be a string literal */ @@ -2307,17 +2307,17 @@ proc_condition : any_identifier if (strspn(sqlstatestr, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ") != =3D 5) yyerror("invalid SQLSTATE code"); =20 - new =3D palloc(sizeof(PLpgSQL_condition)); - new->sqlerrstate =3D + newc =3D palloc(sizeof(PLpgSQL_condition)); + newc->sqlerrstate =3D MAKE_SQLSTATE(sqlstatestr[0], sqlstatestr[1], sqlstatestr[2], sqlstatestr[3], sqlstatestr[4]); - new->condname =3D sqlstatestr; - new->next =3D NULL; + newc->condname =3D sqlstatestr; + newc->next =3D NULL; =20 - $$ =3D new; + $$ =3D newc; } } ; @@ -3117,13 +3117,13 @@ complete_direction(PLpgSQL_stmt_fetch *fetch, bool= *check_FROM) static PLpgSQL_stmt * make_return_stmt(int location) { - PLpgSQL_stmt_return *new; + PLpgSQL_stmt_return *newstmt; =20 - new =3D palloc0(sizeof(PLpgSQL_stmt_return)); - new->cmd_type =3D PLPGSQL_STMT_RETURN; - new->lineno =3D plpgsql_location_to_lineno(location); - new->expr =3D NULL; - new->retvarno =3D -1; + newstmt =3D palloc0(sizeof(PLpgSQL_stmt_return)); + newstmt->cmd_type =3D PLPGSQL_STMT_RETURN; + newstmt->lineno =3D plpgsql_location_to_lineno(location); + newstmt->expr =3D NULL; + newstmt->retvarno =3D -1; =20 if (plpgsql_curr_compile->fn_retset) { @@ -3141,7 +3141,7 @@ make_return_stmt(int location) (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("RETURN cannot have a parameter in function with OUT paramete= rs"), parser_errposition(yylloc))); - new->retvarno =3D plpgsql_curr_compile->out_param_varno; + newstmt->retvarno =3D plpgsql_curr_compile->out_param_varno; } else if (plpgsql_curr_compile->fn_rettype =3D=3D VOIDOID) { @@ -3164,7 +3164,7 @@ make_return_stmt(int location) yylval.wdatum.datum->dtype =3D=3D PLPGSQL_DTYPE_ROW || yylval.wdatum.datum->dtype =3D=3D PLPGSQL_DTYPE_REC)) { - new->retvarno =3D yylval.wdatum.datum->dno; + newstmt->retvarno =3D yylval.wdatum.datum->dno; /* eat the semicolon token that we only peeked at above */ tok =3D yylex(); Assert(tok =3D=3D ';'); @@ -3178,18 +3178,18 @@ make_return_stmt(int location) * anything else is a compile-time error. */ plpgsql_push_back_token(tok); - new->expr =3D read_sql_expression(';', ";"); + newstmt->expr =3D read_sql_expression(';', ";"); } } =20 - return (PLpgSQL_stmt *) new; + return (PLpgSQL_stmt *) newstmt; } =20 =20 static PLpgSQL_stmt * make_return_next_stmt(int location) { - PLpgSQL_stmt_return_next *new; + PLpgSQL_stmt_return_next *newstmt; =20 if (!plpgsql_curr_compile->fn_retset) ereport(ERROR, @@ -3197,11 +3197,11 @@ make_return_next_stmt(int location) errmsg("cannot use RETURN NEXT in a non-SETOF function"), parser_errposition(location))); =20 - new =3D palloc0(sizeof(PLpgSQL_stmt_return_next)); - new->cmd_type =3D PLPGSQL_STMT_RETURN_NEXT; - new->lineno =3D plpgsql_location_to_lineno(location); - new->expr =3D NULL; - new->retvarno =3D -1; + newstmt =3D palloc0(sizeof(PLpgSQL_stmt_return_next)); + newstmt->cmd_type =3D PLPGSQL_STMT_RETURN_NEXT; + newstmt->lineno =3D plpgsql_location_to_lineno(location); + newstmt->expr =3D NULL; + newstmt->retvarno =3D -1; =20 if (plpgsql_curr_compile->out_param_varno >=3D 0) { @@ -3210,7 +3210,7 @@ make_return_next_stmt(int location) (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("RETURN NEXT cannot have a parameter in function with OUT par= ameters"), parser_errposition(yylloc))); - new->retvarno =3D plpgsql_curr_compile->out_param_varno; + newstmt->retvarno =3D plpgsql_curr_compile->out_param_varno; } else { @@ -3225,7 +3225,7 @@ make_return_next_stmt(int location) yylval.wdatum.datum->dtype =3D=3D PLPGSQL_DTYPE_ROW || yylval.wdatum.datum->dtype =3D=3D PLPGSQL_DTYPE_REC)) { - new->retvarno =3D yylval.wdatum.datum->dno; + newstmt->retvarno =3D yylval.wdatum.datum->dno; /* eat the semicolon token that we only peeked at above */ tok =3D yylex(); Assert(tok =3D=3D ';'); @@ -3239,18 +3239,18 @@ make_return_next_stmt(int location) * anything else is a compile-time error. */ plpgsql_push_back_token(tok); - new->expr =3D read_sql_expression(';', ";"); + newstmt->expr =3D read_sql_expression(';', ";"); } } =20 - return (PLpgSQL_stmt *) new; + return (PLpgSQL_stmt *) newstmt; } =20 =20 static PLpgSQL_stmt * make_return_query_stmt(int location) { - PLpgSQL_stmt_return_query *new; + PLpgSQL_stmt_return_query *newstmt; int tok; =20 if (!plpgsql_curr_compile->fn_retset) @@ -3259,23 +3259,23 @@ make_return_query_stmt(int location) errmsg("cannot use RETURN QUERY in a non-SETOF function"), parser_errposition(location))); =20 - new =3D palloc0(sizeof(PLpgSQL_stmt_return_query)); - new->cmd_type =3D PLPGSQL_STMT_RETURN_QUERY; - new->lineno =3D plpgsql_location_to_lineno(location); + newstmt =3D palloc0(sizeof(PLpgSQL_stmt_return_query)); + newstmt->cmd_type =3D PLPGSQL_STMT_RETURN_QUERY; + newstmt->lineno =3D plpgsql_location_to_lineno(location); =20 /* check for RETURN QUERY EXECUTE */ if ((tok =3D yylex()) !=3D K_EXECUTE) { /* ordinary static query */ plpgsql_push_back_token(tok); - new->query =3D read_sql_stmt(""); + newstmt->query =3D read_sql_stmt(""); } else { /* dynamic SQL */ int term; =20 - new->dynquery =3D read_sql_expression2(';', K_USING, "; or USING", + newstmt->dynquery =3D read_sql_expression2(';', K_USING, "; or USING", &term); if (term =3D=3D K_USING) { @@ -3284,12 +3284,12 @@ make_return_query_stmt(int location) PLpgSQL_expr *expr; =20 expr =3D read_sql_expression2(',', ';', ", or ;", &term); - new->params =3D lappend(new->params, expr); + newstmt->params =3D lappend(newstmt->params, expr); } while (term =3D=3D ','); } } =20 - return (PLpgSQL_stmt *) new; + return (PLpgSQL_stmt *) newstmt; } =20 =20 @@ -3936,20 +3936,20 @@ static PLpgSQL_stmt * make_case(int location, PLpgSQL_expr *t_expr, List *case_when_list, List *else_stmts) { - PLpgSQL_stmt_case *new; - - new =3D palloc(sizeof(PLpgSQL_stmt_case)); - new->cmd_type =3D PLPGSQL_STMT_CASE; - new->lineno =3D plpgsql_location_to_lineno(location); - new->t_expr =3D t_expr; - new->t_varno =3D 0; - new->case_when_list =3D case_when_list; - new->have_else =3D (else_stmts !=3D NIL); + PLpgSQL_stmt_case *newstmt; + + newstmt =3D palloc(sizeof(PLpgSQL_stmt_case)); + newstmt->cmd_type =3D PLPGSQL_STMT_CASE; + newstmt->lineno =3D plpgsql_location_to_lineno(location); + newstmt->t_expr =3D t_expr; + newstmt->t_varno =3D 0; + newstmt->case_when_list =3D case_when_list; + newstmt->have_else =3D (else_stmts !=3D NIL); /* Get rid of list-with-NULL hack */ if (list_length(else_stmts) =3D=3D 1 && linitial(else_stmts) =3D=3D NULL) - new->else_stmts =3D NIL; + newstmt->else_stmts =3D NIL; else - new->else_stmts =3D else_stmts; + newstmt->else_stmts =3D else_stmts; =20 /* * When test expression is present, we create a var for it and then @@ -3974,12 +3974,12 @@ make_case(int location, PLpgSQL_expr *t_expr, * variable as if it were INT4; we'll fix this at runtime if needed. */ t_var =3D (PLpgSQL_var *) - plpgsql_build_variable(varname, new->lineno, + plpgsql_build_variable(varname, newstmt->lineno, plpgsql_build_datatype(INT4OID, -1, InvalidOid), true); - new->t_varno =3D t_var->dno; + newstmt->t_varno =3D t_var->dno; =20 foreach(l, case_when_list) { @@ -4005,5 +4005,5 @@ make_case(int location, PLpgSQL_expr *t_expr, } } =20 - return (PLpgSQL_stmt *) new; + return (PLpgSQL_stmt *) newstmt; } diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h index 3421eed74f..2193a95f71 100644 --- a/src/pl/plpgsql/src/plpgsql.h +++ b/src/pl/plpgsql/src/plpgsql.h @@ -1078,7 +1078,7 @@ extern PLpgSQL_rec *plpgsql_build_record(const char *= refname, int lineno, extern int plpgsql_recognize_err_condition(const char *condname, bool allow_sqlstate); extern PLpgSQL_condition *plpgsql_parse_err_condition(char *condname); -extern void plpgsql_adddatum(PLpgSQL_datum *new); +extern void plpgsql_adddatum(PLpgSQL_datum *newdatum); extern int plpgsql_add_initdatums(int **varnos); extern void plpgsql_HashTableInit(void); =20 @@ -1104,7 +1104,7 @@ extern Oid plpgsql_exec_get_datum_type(PLpgSQL_execst= ate *estate, PLpgSQL_datum *datum); extern void plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate, PLpgSQL_datum *datum, - Oid *typeid, int32 *typmod, Oid *collation); + Oid *typid, int32 *typmod, Oid *collation); =20 /* * Functions for namespace handling in pl_funcs.c diff --git a/src/port/path.c b/src/port/path.c index 46f20b1ef8..9e4cd302ac 100644 --- a/src/port/path.c +++ b/src/port/path.c @@ -607,7 +607,7 @@ make_relative_path(char *ret_path, const char *target_p= ath, char * make_absolute_path(const char *path) { - char *new; + char *newpath; =20 /* Returning null for null input is convenient for some callers */ if (path =3D=3D NULL) @@ -658,8 +658,8 @@ make_absolute_path(const char *path) } } =20 - new =3D malloc(strlen(buf) + strlen(path) + 2); - if (!new) + newpath =3D malloc(strlen(buf) + strlen(path) + 2); + if (!newpath) { free(buf); #ifndef FRONTEND @@ -671,13 +671,13 @@ make_absolute_path(const char *path) return NULL; #endif } - sprintf(new, "%s/%s", buf, path); + sprintf(newpath, "%s/%s", buf, path); free(buf); } else { - new =3D strdup(path); - if (!new) + newpath =3D strdup(path); + if (!newpath) { #ifndef FRONTEND ereport(ERROR, @@ -691,9 +691,9 @@ make_absolute_path(const char *path) } =20 /* Make sure punctuation is canonical, too */ - canonicalize_path(new); + canonicalize_path(newpath); =20 - return new; + return newpath; } =20 =20 diff --git a/src/test/isolation/isolationtester.c b/src/test/isolation/isol= ationtester.c index f77f465751..bf567b7672 100644 --- a/src/test/isolation/isolationtester.c +++ b/src/test/isolation/isolationtester.c @@ -347,19 +347,19 @@ run_named_permutations(TestSpec *testspec) /* Find all the named steps using the lookup table */ for (j =3D 0; j < p->nsteps; j++) { - Step **this =3D (Step **) bsearch(p->stepnames[j], + Step **step =3D (Step **) bsearch(p->stepnames[j], testspec->allsteps, testspec->nallsteps, sizeof(Step *), &step_bsearch_cmp); =20 - if (this =3D=3D NULL) + if (step =3D=3D NULL) { fprintf(stderr, "undefined step \"%s\" specified in permutation\n", p->stepnames[j]); exit_nicely(); } - steps[j] =3D *this; + steps[j] =3D *step; } =20 /* And run them */ diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index d4d00d9c66..527113a404 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -327,13 +327,13 @@ signal_remove_temp(int signum) static const char * make_temp_sockdir(void) { - char *template =3D pg_strdup("/tmp/pg_regress-XXXXXX"); + char *tmpl =3D pg_strdup("/tmp/pg_regress-XXXXXX"); =20 - temp_sockdir =3D mkdtemp(template); + temp_sockdir =3D mkdtemp(tmpl); if (temp_sockdir =3D=3D NULL) { fprintf(stderr, _("%s: could not create directory \"%s\": %s\n"), - progname, template, strerror(errno)); + progname, tmpl, strerror(errno)); exit(2); } =20 --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0008-Set-up-for-static-asserts-in-C.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="v2-0008-Set-up-for-static-asserts-in-C.patch" =46rom 7c18f989d0dc430059cce70e5f0e634e18705b91 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 08/23] Set up for static asserts in C++ --- src/include/c.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/include/c.h b/src/include/c.h index 947bd98067..7f303a4f39 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -744,14 +744,26 @@ typedef NameData *Name; * about a negative width for a struct bit-field. This will not include a * helpful error message, but it beats not getting an error at all. */ +#ifdef __cplusplus +#if __cpp_static_assert >=3D 200410 +#define _Static_assert(condition, errmessage) static_assert(condition, err= message) +#define HAVE__STATIC_ASSERT 1 +#endif +#endif + #ifdef HAVE__STATIC_ASSERT #define StaticAssertStmt(condition, errmessage) \ do { _Static_assert(condition, errmessage); } while(0) #define StaticAssertExpr(condition, errmessage) \ ({ StaticAssertStmt(condition, errmessage); true; }) #else /* !HAVE__STATIC_ASSERT */ +#ifdef __cplusplus +#define StaticAssertStmt(condition, errmessage) \ + ((void) 0) +#else #define StaticAssertStmt(condition, errmessage) \ ((void) sizeof(struct { int static_assert_failure : (condition) ? 1 : -1;= })) +#endif #define StaticAssertExpr(condition, errmessage) \ StaticAssertStmt(condition, errmessage) #endif /* HAVE__STATIC_ASSERT */ --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0009-Fix-function-prototypes-for-C.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="v2-0009-Fix-function-prototypes-for-C.patch" =46rom dadbc472a1e06f2b17b758f24827ba431d499cee Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 09/23] Fix function prototypes for C++ C++ needs to have the right number of arguments in function signatures. --- src/backend/nodes/nodeFuncs.c | 28 ++++++++++++++-------------- src/include/nodes/nodeFuncs.h | 20 ++++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/backend/nodes/nodeFuncs.c b/src/backend/nodes/nodeFuncs.c index 71b24a079c..dc6cf47401 100644 --- a/src/backend/nodes/nodeFuncs.c +++ b/src/backend/nodes/nodeFuncs.c @@ -28,10 +28,10 @@ static bool expression_returns_set_walker(Node *node, void *context); static int leftmostLoc(int loc1, int loc2); static bool fix_opfuncids_walker(Node *node, void *context); -static bool planstate_walk_subplans(List *plans, bool (*walker) (), +static bool planstate_walk_subplans(List *plans, bool (*walker) (void *, v= oid *), void *context); static bool planstate_walk_members(List *plans, PlanState **planstates, - bool (*walker) (), void *context); + bool (*walker) (void *, void *), void *context); =20 =20 /* @@ -1850,7 +1850,7 @@ check_functions_in_node(Node *node, check_function_ca= llback checker, =20 bool expression_tree_walker(Node *node, - bool (*walker) (), + bool (*walker) (void *, void *), void *context) { ListCell *temp; @@ -2236,7 +2236,7 @@ expression_tree_walker(Node *node, */ bool query_tree_walker(Query *query, - bool (*walker) (), + bool (*walker) (void *, void *), void *context, int flags) { @@ -2280,7 +2280,7 @@ query_tree_walker(Query *query, */ bool range_table_walker(List *rtable, - bool (*walker) (), + bool (*walker) (void *, void *), void *context, int flags) { @@ -2395,7 +2395,7 @@ range_table_walker(List *rtable, =20 Node * expression_tree_mutator(Node *node, - Node *(*mutator) (), + Node *(*mutator) (void *, void *), void *context) { /* @@ -3038,7 +3038,7 @@ expression_tree_mutator(Node *node, */ Query * query_tree_mutator(Query *query, - Node *(*mutator) (), + Node *(*mutator) (void *, void *), void *context, int flags) { @@ -3077,7 +3077,7 @@ query_tree_mutator(Query *query, */ List * range_table_mutator(List *rtable, - Node *(*mutator) (), + Node *(*mutator) (void *, void *), void *context, int flags) { @@ -3144,7 +3144,7 @@ range_table_mutator(List *rtable, */ bool query_or_expression_tree_walker(Node *node, - bool (*walker) (), + bool (*walker) (void *, void *), void *context, int flags) { @@ -3167,7 +3167,7 @@ query_or_expression_tree_walker(Node *node, */ Node * query_or_expression_tree_mutator(Node *node, - Node *(*mutator) (), + Node *(*mutator) (void *, void *), void *context, int flags) { @@ -3198,7 +3198,7 @@ query_or_expression_tree_mutator(Node *node, */ bool raw_expression_tree_walker(Node *node, - bool (*walker) (), + bool (*walker) (void *, void *), void *context) { ListCell *temp; @@ -3637,7 +3637,7 @@ raw_expression_tree_walker(Node *node, */ bool planstate_tree_walker(PlanState *planstate, - bool (*walker) (), + bool (*walker) (void *, void *), void *context) { Plan *plan =3D planstate->plan; @@ -3721,7 +3721,7 @@ planstate_tree_walker(PlanState *planstate, */ static bool planstate_walk_subplans(List *plans, - bool (*walker) (), + bool (*walker) (void *, void *), void *context) { ListCell *lc; @@ -3746,7 +3746,7 @@ planstate_walk_subplans(List *plans, */ static bool planstate_walk_members(List *plans, PlanState **planstates, - bool (*walker) (), void *context) + bool (*walker) (void *, void *), void *context) { int nplans =3D list_length(plans); int j; diff --git a/src/include/nodes/nodeFuncs.h b/src/include/nodes/nodeFuncs.h index b6c9b48ee6..e5b64d0d30 100644 --- a/src/include/nodes/nodeFuncs.h +++ b/src/include/nodes/nodeFuncs.h @@ -50,31 +50,31 @@ extern void set_sa_opfuncid(ScalarArrayOpExpr *opexpr); extern bool check_functions_in_node(Node *node, check_function_callback ch= ecker, void *context); =20 -extern bool expression_tree_walker(Node *node, bool (*walker) (), +extern bool expression_tree_walker(Node *node, bool (*walker) (void *, voi= d *), void *context); -extern Node *expression_tree_mutator(Node *node, Node *(*mutator) (), +extern Node *expression_tree_mutator(Node *node, Node *(*mutator) (void *,= void *), void *context); =20 -extern bool query_tree_walker(Query *query, bool (*walker) (), +extern bool query_tree_walker(Query *query, bool (*walker) (void *, void *= ), void *context, int flags); -extern Query *query_tree_mutator(Query *query, Node *(*mutator) (), +extern Query *query_tree_mutator(Query *query, Node *(*mutator) (void *, v= oid *), void *context, int flags); =20 -extern bool range_table_walker(List *rtable, bool (*walker) (), +extern bool range_table_walker(List *rtable, bool (*walker) (void *, void = *), void *context, int flags); -extern List *range_table_mutator(List *rtable, Node *(*mutator) (), +extern List *range_table_mutator(List *rtable, Node *(*mutator) (void *, v= oid *), void *context, int flags); =20 -extern bool query_or_expression_tree_walker(Node *node, bool (*walker) (), +extern bool query_or_expression_tree_walker(Node *node, bool (*walker) (vo= id *, void *), void *context, int flags); -extern Node *query_or_expression_tree_mutator(Node *node, Node *(*mutator)= (), +extern Node *query_or_expression_tree_mutator(Node *node, Node *(*mutator)= (void *, void *), void *context, int flags); =20 -extern bool raw_expression_tree_walker(Node *node, bool (*walker) (), +extern bool raw_expression_tree_walker(Node *node, bool (*walker) (void *,= void *), void *context); =20 struct PlanState; -extern bool planstate_tree_walker(struct PlanState *planstate, bool (*walk= er) (), +extern bool planstate_tree_walker(struct PlanState *planstate, bool (*walk= er) (void *, void *), void *context); =20 #endif /* NODEFUNCS_H */ --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0010-Fix-fmgr_oldstyle-for-C.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="v2-0010-Fix-fmgr_oldstyle-for-C.patch" =46rom 454f463597d4732883c163b92f62494a282b9dc8 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 10/23] Fix fmgr_oldstyle for C++ C++ needs the function pointer to have the right number of arguments, so some casts are needed here. --- src/backend/utils/fmgr/fmgr.c | 56 ++++++++++++++++++++++++++++-----------= ---- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c index 3976496aef..49a2f0aacb 100644 --- a/src/backend/utils/fmgr/fmgr.c +++ b/src/backend/utils/fmgr/fmgr.c @@ -52,11 +52,29 @@ PGDLLIMPORT fmgr_hook_type fmgr_hook =3D NULL; * with suitably ugly casts in fmgr_oldstyle(). */ #if (defined(__mc68000__) || (defined(__m68k__))) && defined(__ELF__) -typedef int32 (*func_ptr) (); +#define func_ptr_ret int32 #else -typedef char *(*func_ptr) (); +#define func_ptr_ret char* #endif =20 +typedef func_ptr_ret (*func_ptr) (); +typedef func_ptr_ret (*func1_ptr) (Datum, bool); +typedef func_ptr_ret (*func2_ptr) (Datum, Datum); +typedef func_ptr_ret (*func3_ptr) (Datum, Datum, Datum); +typedef func_ptr_ret (*func4_ptr) (Datum, Datum, Datum, Datum); +typedef func_ptr_ret (*func5_ptr) (Datum, Datum, Datum, Datum, Datum); +typedef func_ptr_ret (*func6_ptr) (Datum, Datum, Datum, Datum, Datum, Datu= m); +typedef func_ptr_ret (*func7_ptr) (Datum, Datum, Datum, Datum, Datum, Datu= m, Datum); +typedef func_ptr_ret (*func8_ptr) (Datum, Datum, Datum, Datum, Datum, Datu= m, Datum, Datum); +typedef func_ptr_ret (*func9_ptr) (Datum, Datum, Datum, Datum, Datum, Datu= m, Datum, Datum, Datum); +typedef func_ptr_ret (*func10_ptr) (Datum, Datum, Datum, Datum, Datum, Dat= um, Datum, Datum, Datum, Datum); +typedef func_ptr_ret (*func11_ptr) (Datum, Datum, Datum, Datum, Datum, Dat= um, Datum, Datum, Datum, Datum, Datum); +typedef func_ptr_ret (*func12_ptr) (Datum, Datum, Datum, Datum, Datum, Dat= um, Datum, Datum, Datum, Datum, Datum, Datum); +typedef func_ptr_ret (*func13_ptr) (Datum, Datum, Datum, Datum, Datum, Dat= um, Datum, Datum, Datum, Datum, Datum, Datum, Datum); +typedef func_ptr_ret (*func14_ptr) (Datum, Datum, Datum, Datum, Datum, Dat= um, Datum, Datum, Datum, Datum, Datum, Datum, Datum, Datum); +typedef func_ptr_ret (*func15_ptr) (Datum, Datum, Datum, Datum, Datum, Dat= um, Datum, Datum, Datum, Datum, Datum, Datum, Datum, Datum, Datum); +typedef func_ptr_ret (*func16_ptr) (Datum, Datum, Datum, Datum, Datum, Dat= um, Datum, Datum, Datum, Datum, Datum, Datum, Datum, Datum, Datum, Datum); + /* * For an oldstyle function, fn_extra points to a record like this: */ @@ -657,7 +675,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) switch (n_arguments) { case 0: - returnValue =3D (char *) (*user_fn) (); + returnValue =3D (char *) (user_fn) (); break; case 1: =20 @@ -666,33 +684,33 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) * there are other functions still out there that also rely on * this undocumented hack? */ - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func1_ptr) user_fn) (fcinfo->arg[0], &fcinfo->isnull); break; case 2: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func2_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1]); break; case 3: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func3_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2]); break; case 4: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func4_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3]); break; case 5: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func5_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], fcinfo->arg[4]); break; case 6: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func6_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -700,7 +718,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[5]); break; case 7: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func7_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -709,7 +727,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[6]); break; case 8: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func8_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -719,7 +737,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[7]); break; case 9: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func9_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -730,7 +748,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[8]); break; case 10: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func10_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -742,7 +760,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[9]); break; case 11: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func11_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -755,7 +773,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[10]); break; case 12: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func12_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -769,7 +787,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[11]); break; case 13: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func13_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -784,7 +802,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[12]); break; case 14: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func14_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -800,7 +818,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[13]); break; case 15: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func15_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], @@ -817,7 +835,7 @@ fmgr_oldstyle(PG_FUNCTION_ARGS) fcinfo->arg[14]); break; case 16: - returnValue =3D (char *) (*user_fn) (fcinfo->arg[0], + returnValue =3D (char *) ((func16_ptr) user_fn) (fcinfo->arg[0], fcinfo->arg[1], fcinfo->arg[2], fcinfo->arg[3], --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0011-Don-t-define-bool-in-C.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="v2-0011-Don-t-define-bool-in-C.patch" =46rom 47a7faf131bbee1e56f31220253798f955b05d65 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 11/23] Don't define bool in C++ --- src/test/thread/thread_test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/thread/thread_test.c b/src/test/thread/thread_test.c index cb93bcc5ab..7ee0991988 100644 --- a/src/test/thread/thread_test.c +++ b/src/test/thread/thread_test.c @@ -24,6 +24,8 @@ #include "postgres.h" #else /* From src/include/c.h" */ +#ifndef __cplusplus + #ifndef bool typedef char bool; #endif @@ -37,6 +39,8 @@ typedef char bool; #endif #endif =20 +#endif + #include #include #include --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0012-Change-TimeoutId-from-enum-to-integer.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="v2-0012-Change-TimeoutId-from-enum-to-integer.patch" =46rom 6c22f8b7f692d4fe26f807453a2b97993db4cae0 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 12/23] Change TimeoutId from enum to integer RegisterTimeout() treats it like an integer. C++ doesn't like enums to be treated that way. --- src/include/utils/timeout.h | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/include/utils/timeout.h b/src/include/utils/timeout.h index aa816334c0..9d5eaa1b5c 100644 --- a/src/include/utils/timeout.h +++ b/src/include/utils/timeout.h @@ -20,22 +20,21 @@ * Identifiers for timeout reasons. Note that in case multiple timeouts * trigger at the same time, they are serviced in the order of this enum. */ -typedef enum TimeoutId -{ +typedef int TimeoutId; + /* Predefined timeout reasons */ - STARTUP_PACKET_TIMEOUT, - DEADLOCK_TIMEOUT, - LOCK_TIMEOUT, - STATEMENT_TIMEOUT, - STANDBY_DEADLOCK_TIMEOUT, - STANDBY_TIMEOUT, - STANDBY_LOCK_TIMEOUT, - IDLE_IN_TRANSACTION_SESSION_TIMEOUT, +const int STARTUP_PACKET_TIMEOUT =3D 1; +const int DEADLOCK_TIMEOUT =3D 2; +const int LOCK_TIMEOUT =3D 3; +const int STATEMENT_TIMEOUT =3D 4; +const int STANDBY_DEADLOCK_TIMEOUT =3D 5; +const int STANDBY_TIMEOUT =3D 6; +const int STANDBY_LOCK_TIMEOUT =3D 7; +const int IDLE_IN_TRANSACTION_SESSION_TIMEOUT =3D 8; /* First user-definable timeout reason */ - USER_TIMEOUT, +const int USER_TIMEOUT =3D 9; /* Maximum number of timeout reasons */ - MAX_TIMEOUTS =3D 16 -} TimeoutId; +const int MAX_TIMEOUTS =3D 16; =20 /* callback function signature */ typedef void (*timeout_handler_proc) (void); --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0013-Add-explicit-cast-for-casting-away-volatile.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="v2-0013-Add-explicit-cast-for-casting-away-volatile.patch" =46rom d5af10acb48cd1688cc0fbed1b748765a3619286 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 13/23] Add explicit cast for casting away volatile --- contrib/pg_stat_statements/pg_stat_statements.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_s= tat_statements/pg_stat_statements.c index 62dec8768a..bda5ec61ed 100644 --- a/contrib/pg_stat_statements/pg_stat_statements.c +++ b/contrib/pg_stat_statements/pg_stat_statements.c @@ -1594,7 +1594,7 @@ pg_stat_statements_internal(FunctionCallInfo fcinfo, volatile pgssEntry *e =3D (volatile pgssEntry *) entry; =20 SpinLockAcquire(&e->mutex); - tmp =3D e->counters; + tmp =3D const_cast(e)->counters; SpinLockRelease(&e->mutex); } =20 --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0014-Add-more-extern-key-words.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="v2-0014-Add-more-extern-key-words.patch" =46rom 2f1c496f88a3487a41ffd1922f35966601e8d57e Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 14/23] Add more extern key words C++ needs those to make the definitions visible externally. This is not compatible with C. --- src/backend/access/rmgrdesc/xlogdesc.c | 2 +- src/backend/access/transam/xlog.c | 4 ++-- src/backend/storage/ipc/dsm_impl.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backend/access/rmgrdesc/xlogdesc.c b/src/backend/access/rm= grdesc/xlogdesc.c index 5f07eb1499..9a968746c0 100644 --- a/src/backend/access/rmgrdesc/xlogdesc.c +++ b/src/backend/access/rmgrdesc/xlogdesc.c @@ -23,7 +23,7 @@ /* * GUC support */ -const struct config_enum_entry wal_level_options[] =3D { +extern const struct config_enum_entry wal_level_options[] =3D { {"minimal", WAL_LEVEL_MINIMAL, false}, {"replica", WAL_LEVEL_REPLICA, false}, {"archive", WAL_LEVEL_REPLICA, true}, /* deprecated */ diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam= /xlog.c index 038b8472ae..20ea393103 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -129,7 +129,7 @@ static double PrevCheckPointDistance =3D 0; /* * GUC support */ -const struct config_enum_entry sync_method_options[] =3D { +extern const struct config_enum_entry sync_method_options[] =3D { {"fsync", SYNC_METHOD_FSYNC, false}, #ifdef HAVE_FSYNC_WRITETHROUGH {"fsync_writethrough", SYNC_METHOD_FSYNC_WRITETHROUGH, false}, @@ -151,7 +151,7 @@ const struct config_enum_entry sync_method_options[] = =3D { * Although only "on", "off", and "always" are documented, * we accept all the likely variants of "on" and "off". */ -const struct config_enum_entry archive_mode_options[] =3D { +extern const struct config_enum_entry archive_mode_options[] =3D { {"always", ARCHIVE_MODE_ALWAYS, false}, {"on", ARCHIVE_MODE_ON, false}, {"off", ARCHIVE_MODE_OFF, false}, diff --git a/src/backend/storage/ipc/dsm_impl.c b/src/backend/storage/ipc/d= sm_impl.c index b2c9cdc6ed..0d3f595d04 100644 --- a/src/backend/storage/ipc/dsm_impl.c +++ b/src/backend/storage/ipc/dsm_impl.c @@ -90,7 +90,7 @@ static bool dsm_impl_mmap(dsm_op op, dsm_handle handle, S= ize request_size, #endif static int errcode_for_dynamic_shared_memory(void); =20 -const struct config_enum_entry dynamic_shared_memory_options[] =3D { +extern const struct config_enum_entry dynamic_shared_memory_options[] =3D { #ifdef USE_DSM_POSIX {"posix", DSM_IMPL_POSIX, false}, #endif --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0015-Workaround-for-using-typdef-ed-ints-in-loops.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="v2-0015-Workaround-for-using-typdef-ed-ints-in-loops.patch" =46rom 693053ed41fa303cae322b834ae33d880f829de0 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 15/23] Workaround for using typdef'ed ints in loops Types made from int don't have a ++ operator in C++, so they can't be used in for loops without further work. Needs more research --- src/backend/access/transam/xact.c | 4 ++-- src/backend/commands/tablecmds.c | 2 +- src/backend/storage/smgr/md.c | 8 ++++---- src/backend/storage/smgr/smgr.c | 6 +++--- src/backend/utils/adt/dbsize.c | 6 +++--- src/bin/pgbench/pgbench.c | 5 ++++- src/common/relpath.c | 4 ++-- 7 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam= /xact.c index 82f9a3c5c6..d9a33bc933 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -5460,7 +5460,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed, for (i =3D 0; i < parsed->nrels; i++) { SMgrRelation srel =3D smgropen(parsed->xnodes[i], InvalidBackendId); - ForkNumber fork; + int fork; =20 for (fork =3D 0; fork <=3D MAX_FORKNUM; fork++) XLogDropRelation(parsed->xnodes[i], fork); @@ -5570,7 +5570,7 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, Transac= tionId xid) for (i =3D 0; i < parsed->nrels; i++) { SMgrRelation srel =3D smgropen(parsed->xnodes[i], InvalidBackendId); - ForkNumber fork; + int fork; =20 for (fork =3D 0; fork <=3D MAX_FORKNUM; fork++) XLogDropRelation(parsed->xnodes[i], fork); diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablec= mds.c index 56906d603c..f1fffb7edd 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -10107,7 +10107,7 @@ ATExecSetTableSpace(Oid tableOid, Oid newTableSpace= , LOCKMODE lockmode) Relation pg_class; HeapTuple tuple; Form_pg_class rd_rel; - ForkNumber forkNum; + int forkNum; List *reltoastidxids =3D NIL; ListCell *lc; =20 diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c index 6c17b54f0d..201edaaeed 100644 --- a/src/backend/storage/smgr/md.c +++ b/src/backend/storage/smgr/md.c @@ -398,7 +398,7 @@ mdunlink(RelFileNodeBackend rnode, ForkNumber forkNum, = bool isRedo) /* Now do the per-fork work */ if (forkNum =3D=3D InvalidForkNumber) { - for (forkNum =3D 0; forkNum <=3D MAX_FORKNUM; forkNum++) + for (int forkNum =3D 0; forkNum <=3D MAX_FORKNUM; forkNum++) mdunlinkfork(rnode, forkNum, isRedo); } else @@ -1130,7 +1130,7 @@ mdsync(void) hash_seq_init(&hstat, pendingOpsTable); while ((entry =3D (PendingOperationEntry *) hash_seq_search(&hstat)) !=3D= NULL) { - ForkNumber forknum; + int forknum; =20 /* * If the entry is new then don't process it this time; it might @@ -1535,7 +1535,7 @@ RememberFsyncRequest(RelFileNode rnode, ForkNumber fo= rknum, BlockNumber segno) if (forknum =3D=3D InvalidForkNumber) { /* remove requests for all forks */ - for (forknum =3D 0; forknum <=3D MAX_FORKNUM; forknum++) + for (int forknum =3D 0; forknum <=3D MAX_FORKNUM; forknum++) { bms_free(entry->requests[forknum]); entry->requests[forknum] =3D NULL; @@ -1567,7 +1567,7 @@ RememberFsyncRequest(RelFileNode rnode, ForkNumber fo= rknum, BlockNumber segno) if (entry->rnode.dbNode =3D=3D rnode.dbNode) { /* remove requests for all forks */ - for (forknum =3D 0; forknum <=3D MAX_FORKNUM; forknum++) + for (int forknum =3D 0; forknum <=3D MAX_FORKNUM; forknum++) { bms_free(entry->requests[forknum]); entry->requests[forknum] =3D NULL; diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smg= r.c index 0ed1fe91d5..d0699ae619 100644 --- a/src/backend/storage/smgr/smgr.c +++ b/src/backend/storage/smgr/smgr.c @@ -296,7 +296,7 @@ void smgrclose(SMgrRelation reln) { SMgrRelation *owner; - ForkNumber forknum; + int forknum; =20 for (forknum =3D 0; forknum <=3D MAX_FORKNUM; forknum++) (*(smgrsw[reln->smgr_which].smgr_close)) (reln, forknum); @@ -415,7 +415,7 @@ smgrdounlink(SMgrRelation reln, bool isRedo) { RelFileNodeBackend rnode =3D reln->smgr_rnode; int which =3D reln->smgr_which; - ForkNumber forknum; + int forknum; =20 /* Close the forks at smgr level */ for (forknum =3D 0; forknum <=3D MAX_FORKNUM; forknum++) @@ -472,7 +472,7 @@ smgrdounlinkall(SMgrRelation *rels, int nrels, bool isR= edo) { int i =3D 0; RelFileNodeBackend *rnodes; - ForkNumber forknum; + int forknum; =20 if (nrels =3D=3D 0) return; diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c index 8cdd1dc4f7..340f7a08bf 100644 --- a/src/backend/utils/adt/dbsize.c +++ b/src/backend/utils/adt/dbsize.c @@ -341,7 +341,7 @@ calculate_toast_table_size(Oid toastrelid) { int64 size =3D 0; Relation toastRel; - ForkNumber forkNum; + int forkNum; ListCell *lc; List *indexlist; =20 @@ -386,7 +386,7 @@ static int64 calculate_table_size(Relation rel) { int64 size =3D 0; - ForkNumber forkNum; + int forkNum; =20 /* * heap size, including FSM and VM @@ -426,7 +426,7 @@ calculate_indexes_size(Relation rel) { Oid idxOid =3D lfirst_oid(cell); Relation idxRel; - ForkNumber forkNum; + int forkNum; =20 idxRel =3D relation_open(idxOid, AccessShareLock); =20 diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index f6cb5d4b10..83cc0e7cf2 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -3901,9 +3901,12 @@ main(int argc, char **argv) fprintf(stderr, "query mode (-M) should be specified before any trans= action scripts (-f or -b)\n"); exit(1); } - for (querymode =3D 0; querymode < NUM_QUERYMODE; querymode++) + for (int qm =3D 0; qm < NUM_QUERYMODE; qm++) if (strcmp(optarg, QUERYMODE[querymode]) =3D=3D 0) + { + querymode =3D qm; break; + } if (querymode >=3D NUM_QUERYMODE) { fprintf(stderr, "invalid query mode (-M): \"%s\"\n", diff --git a/src/common/relpath.c b/src/common/relpath.c index c2f36625c1..911ca7543e 100644 --- a/src/common/relpath.c +++ b/src/common/relpath.c @@ -47,7 +47,7 @@ const char *const forkNames[] =3D { ForkNumber forkname_to_number(const char *forkName) { - ForkNumber forkNum; + int forkNum; =20 for (forkNum =3D 0; forkNum <=3D MAX_FORKNUM; forkNum++) if (strcmp(forkNames[forkNum], forkName) =3D=3D 0) @@ -78,7 +78,7 @@ forkname_to_number(const char *forkName) int forkname_chars(const char *str, ForkNumber *fork) { - ForkNumber forkNum; + int forkNum; =20 for (forkNum =3D 1; forkNum <=3D MAX_FORKNUM; forkNum++) { --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0016-Disable-conflicting-function.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="v2-0016-Disable-conflicting-function.patch" =46rom 181fd5d60161236bf5ae706246d6f2ae035aa9e6 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 16/23] Disable conflicting function This function conflicts with a function in the backend. FIXME --- contrib/xml2/xpath.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/xml2/xpath.c b/contrib/xml2/xpath.c index 73b74c875e..0f76ac0030 100644 --- a/contrib/xml2/xpath.c +++ b/contrib/xml2/xpath.c @@ -90,6 +90,7 @@ pgxml_parser_init(PgXmlStrictness strictness) * definitions for the contrib module, this won't be called. */ =20 +#ifdef BROKEN PG_FUNCTION_INFO_V1(xml_is_well_formed); =20 Datum @@ -124,6 +125,7 @@ xml_is_well_formed(PG_FUNCTION_ARGS) =20 PG_RETURN_BOOL(result); } +#endif =20 =20 /* Encodes special characters (<, >, &, " and \r) as XML entities */ --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0017-Add-C-linkage-to-replacement-declaration-of-fdata.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="v2-0017-Add-C-linkage-to-replacement-declaration-of-fdata.pa"; filename*1="tch" =46rom b69fe61410413e7c1b504704e782e857b8af9e3a Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 17/23] Add C linkage to replacement declaration of fdatasync --- src/include/c.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/c.h b/src/include/c.h index 7f303a4f39..4adb249e75 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -1103,7 +1103,7 @@ extern int vsnprintf(char *str, size_t count, const c= har *fmt, va_list args); #endif =20 #if defined(HAVE_FDATASYNC) && !HAVE_DECL_FDATASYNC -extern int fdatasync(int fildes); +extern "C" int fdatasync(int fildes); #endif =20 /* If strtoq() exists, rename it to the more standard strtoll() */ --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0018-Make-inet_net_-to-C-linkage.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="v2-0018-Make-inet_net_-to-C-linkage.patch" =46rom 530db2d66ad1dfe8b82c24e29556f2400954a6b7 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 18/23] Make inet_net_?to? C linkage These functions can also be declared by the operating system, so we need to match the linkage. --- src/include/port.h | 2 +- src/include/utils/builtins.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/port.h b/src/include/port.h index f4546016e7..30da8e7d90 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -452,7 +452,7 @@ extern int pg_codepage_to_encoding(UINT cp); #endif =20 /* port/inet_net_ntop.c */ -extern char *inet_net_ntop(int af, const void *src, int bits, +extern "C" char *inet_net_ntop(int af, const void *src, int bits, char *dst, size_t size); =20 /* port/pg_strong_random.c */ diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index 5bdca8203d..099b37d226 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -98,7 +98,7 @@ extern char *inet_cidr_ntop(int af, const void *src, int = bits, char *dst, size_t size); =20 /* inet_net_pton.c */ -extern int inet_net_pton(int af, const char *src, +extern "C" int inet_net_pton(int af, const char *src, void *dst, size_t size); =20 /* network.c */ --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0019-Add-C-linkage-to-functions-exported-by-plugins.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="v2-0019-Add-C-linkage-to-functions-exported-by-plugins.patch" =46rom 207ff8aca4a74af2756c6a345286ebecd139d759 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 19/23] Add C linkage to functions exported by plugins This is required so dlsym() can find them reliably. --- contrib/auth_delay/auth_delay.c | 2 +- contrib/auto_explain/auto_explain.c | 4 ++-- contrib/bloom/bloom.h | 2 +- contrib/earthdistance/earthdistance.c | 2 +- contrib/hstore/hstore.h | 8 +++++--- contrib/hstore_plperl/hstore_plperl.c | 2 +- contrib/hstore_plpython/hstore_plpython.c | 2 +- contrib/ltree/ltree.h | 2 ++ contrib/ltree_plpython/ltree_plpython.c | 2 +- contrib/passwordcheck/passwordcheck.c | 2 +- contrib/pg_stat_statements/pg_stat_statements.c | 2 ++ contrib/pg_trgm/trgm_op.c | 2 +- contrib/seg/seg.c | 6 ++++++ contrib/sepgsql/hooks.c | 2 +- contrib/test_decoding/test_decoding.c | 4 ++-- src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | 2 +- src/backend/replication/pgoutput/pgoutput.c | 2 +- src/include/fmgr.h | 6 +++--- src/pl/plperl/plperl.c | 2 ++ src/pl/plpgsql/src/plpgsql.h | 2 +- src/pl/plpython/plpy_main.c | 2 ++ src/pl/plpython/plpy_typeio.h | 2 +- src/pl/tcl/pltcl.c | 2 ++ src/test/modules/dummy_seclabel/dummy_seclabel.c | 2 +- src/test/modules/test_rls_hooks/test_rls_hooks.c | 2 ++ src/test/modules/test_shm_mq/test.c | 2 +- src/test/modules/test_shm_mq/test_shm_mq.h | 2 +- src/test/modules/worker_spi/worker_spi.c | 2 +- src/test/regress/regress.c | 8 +++++--- 29 files changed, 52 insertions(+), 30 deletions(-) diff --git a/contrib/auth_delay/auth_delay.c b/contrib/auth_delay/auth_dela= y.c index e0604fb808..7eae401403 100644 --- a/contrib/auth_delay/auth_delay.c +++ b/contrib/auth_delay/auth_delay.c @@ -20,7 +20,7 @@ =20 PG_MODULE_MAGIC; =20 -void _PG_init(void); +extern "C" void _PG_init(void); =20 /* GUC Variables */ static int auth_delay_milliseconds; diff --git a/contrib/auto_explain/auto_explain.c b/contrib/auto_explain/aut= o_explain.c index 34b9f1543e..319c7a9c7b 100644 --- a/contrib/auto_explain/auto_explain.c +++ b/contrib/auto_explain/auto_explain.c @@ -55,8 +55,8 @@ static bool current_query_sampled =3D true; (auto_explain_log_min_duration >=3D 0 && \ (nesting_level =3D=3D 0 || auto_explain_log_nested_statements)) =20 -void _PG_init(void); -void _PG_fini(void); +extern "C" void _PG_init(void); +extern "C" void _PG_fini(void); =20 static void explain_ExecutorStart(QueryDesc *queryDesc, int eflags); static void explain_ExecutorRun(QueryDesc *queryDesc, diff --git a/contrib/bloom/bloom.h b/contrib/bloom/bloom.h index 0cfe49aad8..d4ab749e95 100644 --- a/contrib/bloom/bloom.h +++ b/contrib/bloom/bloom.h @@ -173,7 +173,7 @@ typedef struct BloomScanOpaqueData typedef BloomScanOpaqueData *BloomScanOpaque; =20 /* blutils.c */ -extern void _PG_init(void); +extern "C" void _PG_init(void); extern void initBloomState(BloomState *state, Relation index); extern void BloomFillMetapage(Relation index, Page metaPage); extern void BloomInitMetapage(Relation index); diff --git a/contrib/earthdistance/earthdistance.c b/contrib/earthdistance/= earthdistance.c index 861b166373..305be5d932 100644 --- a/contrib/earthdistance/earthdistance.c +++ b/contrib/earthdistance/earthdistance.c @@ -112,7 +112,7 @@ geo_distance(PG_FUNCTION_ARGS) } #else /* !USE_FLOAT8_BYVAL */ =20 -double *geo_distance(Point *pt1, Point *pt2); +extern "C" double *geo_distance(Point *pt1, Point *pt2); =20 double * geo_distance(Point *pt1, Point *pt2) diff --git a/contrib/hstore/hstore.h b/contrib/hstore/hstore.h index fbedc971c0..323faa4b8c 100644 --- a/contrib/hstore/hstore.h +++ b/contrib/hstore/hstore.h @@ -147,7 +147,7 @@ typedef struct } while (0) =20 /* DatumGetHStoreP includes support for reading old-format hstore values */ -extern HStore *hstoreUpgrade(Datum orig); +extern "C" HStore *hstoreUpgrade(Datum orig); =20 #define DatumGetHStoreP(d) hstoreUpgrade(d) =20 @@ -168,6 +168,7 @@ typedef struct bool needfree; /* need to pfree the value? */ } Pairs; =20 +extern "C" { extern int hstoreUniquePairs(Pairs *a, int32 l, int32 *buflen); extern HStore *hstorePairs(Pairs *pairs, int32 pcount, int32 buflen); =20 @@ -176,6 +177,7 @@ extern size_t hstoreCheckValLen(size_t len); =20 extern int hstoreFindKey(HStore *hs, int *lowbound, char *key, int keylen); extern Pairs *hstoreArrayToPairs(ArrayType *a, int *npairs); +} =20 #define HStoreContainsStrategyNumber 7 #define HStoreExistsStrategyNumber 9 @@ -194,8 +196,8 @@ extern Pairs *hstoreArrayToPairs(ArrayType *a, int *npa= irs); #if HSTORE_POLLUTE_NAMESPACE #define HSTORE_POLLUTE(newname_,oldname_) \ PG_FUNCTION_INFO_V1(oldname_); \ - Datum newname_(PG_FUNCTION_ARGS); \ - Datum oldname_(PG_FUNCTION_ARGS) { return newname_(fcinfo); } \ + extern "C" Datum newname_(PG_FUNCTION_ARGS); \ + extern "C" Datum oldname_(PG_FUNCTION_ARGS) { return newname_(fcinfo); } \ extern int no_such_variable #else #define HSTORE_POLLUTE(newname_,oldname_) \ diff --git a/contrib/hstore_plperl/hstore_plperl.c b/contrib/hstore_plperl/= hstore_plperl.c index 480212f341..be252e4b7e 100644 --- a/contrib/hstore_plperl/hstore_plperl.c +++ b/contrib/hstore_plperl/hstore_plperl.c @@ -9,7 +9,7 @@ =20 PG_MODULE_MAGIC; =20 -extern void _PG_init(void); +extern "C" void _PG_init(void); =20 /* Linkage to functions in hstore module */ typedef HStore *(*hstoreUpgrade_t) (Datum orig); diff --git a/contrib/hstore_plpython/hstore_plpython.c b/contrib/hstore_plp= ython/hstore_plpython.c index b184324ebf..d9cf139a97 100644 --- a/contrib/hstore_plpython/hstore_plpython.c +++ b/contrib/hstore_plpython/hstore_plpython.c @@ -7,7 +7,7 @@ =20 PG_MODULE_MAGIC; =20 -extern void _PG_init(void); +extern "C" void _PG_init(void); =20 /* Linkage to functions in plpython module */ typedef char *(*PLyObject_AsString_t) (PyObject *plrv); diff --git a/contrib/ltree/ltree.h b/contrib/ltree/ltree.h index c604357dbf..277b9a4206 100644 --- a/contrib/ltree/ltree.h +++ b/contrib/ltree/ltree.h @@ -130,6 +130,7 @@ typedef struct =20 =20 /* use in array iterator */ +extern "C" { Datum ltree_isparent(PG_FUNCTION_ARGS); Datum ltree_risparent(PG_FUNCTION_ARGS); Datum ltq_regex(PG_FUNCTION_ARGS); @@ -154,6 +155,7 @@ Datum ltree_textadd(PG_FUNCTION_ARGS); =20 /* Util function */ Datum ltree_in(PG_FUNCTION_ARGS); +} =20 bool ltree_execute(ITEM *curitem, void *checkval, bool calcnot, bool (*chkcond) (void *checkval, ITEM *val)); diff --git a/contrib/ltree_plpython/ltree_plpython.c b/contrib/ltree_plpyth= on/ltree_plpython.c index bdd462a91b..0bedf005ae 100644 --- a/contrib/ltree_plpython/ltree_plpython.c +++ b/contrib/ltree_plpython/ltree_plpython.c @@ -6,7 +6,7 @@ =20 PG_MODULE_MAGIC; =20 -extern void _PG_init(void); +extern "C" void _PG_init(void); =20 /* Linkage to functions in plpython module */ #if PY_MAJOR_VERSION >=3D 3 diff --git a/contrib/passwordcheck/passwordcheck.c b/contrib/passwordcheck/= passwordcheck.c index c988bf5169..7fa530284a 100644 --- a/contrib/passwordcheck/passwordcheck.c +++ b/contrib/passwordcheck/passwordcheck.c @@ -29,7 +29,7 @@ PG_MODULE_MAGIC; /* passwords shorter than this will be rejected */ #define MIN_PWD_LENGTH 8 =20 -extern void _PG_init(void); +extern "C" void _PG_init(void); =20 /* * check_password diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_s= tat_statements/pg_stat_statements.c index bda5ec61ed..bbd926eb10 100644 --- a/contrib/pg_stat_statements/pg_stat_statements.c +++ b/contrib/pg_stat_statements/pg_stat_statements.c @@ -276,8 +276,10 @@ static bool pgss_save; /* whether to save stats acro= ss shutdown */ =20 /*---- Function declarations ----*/ =20 +extern "C" { void _PG_init(void); void _PG_fini(void); +} =20 PG_FUNCTION_INFO_V1(pg_stat_statements_reset); PG_FUNCTION_INFO_V1(pg_stat_statements_1_2); diff --git a/contrib/pg_trgm/trgm_op.c b/contrib/pg_trgm/trgm_op.c index 368e7c8941..654b5c4644 100644 --- a/contrib/pg_trgm/trgm_op.c +++ b/contrib/pg_trgm/trgm_op.c @@ -19,7 +19,7 @@ PG_MODULE_MAGIC; double similarity_threshold =3D 0.3f; double word_similarity_threshold =3D 0.6f; =20 -void _PG_init(void); +extern "C" void _PG_init(void); =20 PG_FUNCTION_INFO_V1(set_limit); PG_FUNCTION_INFO_V1(show_limit); diff --git a/contrib/seg/seg.c b/contrib/seg/seg.c index 895d879498..b98de5f66c 100644 --- a/contrib/seg/seg.c +++ b/contrib/seg/seg.c @@ -47,6 +47,7 @@ PG_FUNCTION_INFO_V1(seg_center); /* ** GiST support methods */ +extern "C" { bool gseg_consistent(GISTENTRY *entry, SEG *query, StrategyNumber strategy, @@ -61,11 +62,13 @@ bool gseg_internal_consistent(SEG *key, SEG *query, St= rategyNumber strategy); SEG *gseg_union(GistEntryVector *entryvec, int *sizep); SEG *gseg_binary_union(SEG *r1, SEG *r2, int *sizep); bool *gseg_same(SEG *b1, SEG *b2, bool *result); +} =20 =20 /* ** R-tree support functions */ +extern "C" { bool seg_same(SEG *a, SEG *b); bool seg_contains_int(SEG *a, int *b); bool seg_contains_float4(SEG *a, float4 *b); @@ -80,16 +83,19 @@ bool seg_over_right(SEG *a, SEG *b); SEG *seg_union(SEG *a, SEG *b); SEG *seg_inter(SEG *a, SEG *b); void rt_seg_size(SEG *a, float *sz); +} =20 /* ** Various operators */ +extern "C" { int32 seg_cmp(SEG *a, SEG *b); bool seg_lt(SEG *a, SEG *b); bool seg_le(SEG *a, SEG *b); bool seg_gt(SEG *a, SEG *b); bool seg_ge(SEG *a, SEG *b); bool seg_different(SEG *a, SEG *b); +} =20 /* ** Auxiliary funxtions diff --git a/contrib/sepgsql/hooks.c b/contrib/sepgsql/hooks.c index 93cc8debaa..f80826f23f 100644 --- a/contrib/sepgsql/hooks.c +++ b/contrib/sepgsql/hooks.c @@ -30,7 +30,7 @@ PG_MODULE_MAGIC; /* * Declarations */ -void _PG_init(void); +extern "C" void _PG_init(void); =20 /* * Saved hook entries (if stacked) diff --git a/contrib/test_decoding/test_decoding.c b/contrib/test_decoding/= test_decoding.c index 21cfd673c6..df81fb5a54 100644 --- a/contrib/test_decoding/test_decoding.c +++ b/contrib/test_decoding/test_decoding.c @@ -35,8 +35,8 @@ PG_MODULE_MAGIC; =20 /* These must be available to pg_dlsym() */ -extern void _PG_init(void); -extern void _PG_output_plugin_init(OutputPluginCallbacks *cb); +extern "C" void _PG_init(void); +extern "C" void _PG_output_plugin_init(OutputPluginCallbacks *cb); =20 typedef struct { diff --git a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c b/= src/backend/replication/libpqwalreceiver/libpqwalreceiver.c index daae3f70e7..239f250790 100644 --- a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c +++ b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c @@ -33,7 +33,7 @@ =20 PG_MODULE_MAGIC; =20 -void _PG_init(void); +extern "C" void _PG_init(void); =20 struct WalReceiverConn { diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/repl= ication/pgoutput/pgoutput.c index 0ceb4be375..b83889eb70 100644 --- a/src/backend/replication/pgoutput/pgoutput.c +++ b/src/backend/replication/pgoutput/pgoutput.c @@ -27,7 +27,7 @@ =20 PG_MODULE_MAGIC; =20 -extern void _PG_output_plugin_init(OutputPluginCallbacks *cb); +extern "C" void _PG_output_plugin_init(OutputPluginCallbacks *cb); =20 static void pgoutput_startup(LogicalDecodingContext * ctx, OutputPluginOptions *opt, bool is_init); diff --git a/src/include/fmgr.h b/src/include/fmgr.h index a671480004..8f1eccfb88 100644 --- a/src/include/fmgr.h +++ b/src/include/fmgr.h @@ -355,8 +355,8 @@ typedef const Pg_finfo_record *(*PGFInfoFunction) (void= ); * info function, since authors shouldn't need to be explicitly aware of i= t. */ #define PG_FUNCTION_INFO_V1(funcname) \ -extern Datum funcname(PG_FUNCTION_ARGS); \ -extern PGDLLEXPORT const Pg_finfo_record * CppConcat(pg_finfo_,funcname)(v= oid); \ +extern "C" Datum funcname(PG_FUNCTION_ARGS); \ +extern "C" PGDLLEXPORT const Pg_finfo_record * CppConcat(pg_finfo_,funcnam= e)(void); \ const Pg_finfo_record * \ CppConcat(pg_finfo_,funcname) (void) \ { \ @@ -425,7 +425,7 @@ typedef const Pg_magic_struct *(*PGModuleMagicFunction)= (void); #define PG_MAGIC_FUNCTION_NAME_STRING "Pg_magic_func" =20 #define PG_MODULE_MAGIC \ -extern PGDLLEXPORT const Pg_magic_struct *PG_MAGIC_FUNCTION_NAME(void); \ +extern "C" PGDLLEXPORT const Pg_magic_struct *PG_MAGIC_FUNCTION_NAME(void)= ; \ const Pg_magic_struct * \ PG_MAGIC_FUNCTION_NAME(void) \ { \ diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index 00979cba74..e07ad0d321 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -246,7 +246,9 @@ static plperl_call_data *current_call_data =3D NULL; /********************************************************************** * Forward declarations **********************************************************************/ +extern "C" { void _PG_init(void); +} =20 static PerlInterpreter *plperl_init_interp(void); static void plperl_destroy_interp(PerlInterpreter **); diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h index 2193a95f71..ee5982e3c8 100644 --- a/src/pl/plpgsql/src/plpgsql.h +++ b/src/pl/plpgsql/src/plpgsql.h @@ -1085,7 +1085,7 @@ extern void plpgsql_HashTableInit(void); /* * Functions in pl_handler.c */ -extern void _PG_init(void); +extern "C" void _PG_init(void); =20 /* * Functions in pl_exec.c diff --git a/src/pl/plpython/plpy_main.c b/src/pl/plpython/plpy_main.c index 860b804e54..efd3bf0002 100644 --- a/src/pl/plpython/plpy_main.c +++ b/src/pl/plpython/plpy_main.c @@ -39,7 +39,9 @@ #define plpython_inline_handler plpython3_inline_handler #endif =20 +extern "C" { extern void _PG_init(void); +} =20 PG_MODULE_MAGIC; =20 diff --git a/src/pl/plpython/plpy_typeio.h b/src/pl/plpython/plpy_typeio.h index e04722c47a..0793927fff 100644 --- a/src/pl/plpython/plpy_typeio.h +++ b/src/pl/plpython/plpy_typeio.h @@ -117,6 +117,6 @@ extern Datum PLyObject_ToCompositeDatum(PLyTypeInfo *in= fo, TupleDesc desc, PyObj extern PyObject *PLyDict_FromTuple(PLyTypeInfo *info, HeapTuple tuple, Tup= leDesc desc); =20 /* conversion from Python objects to C strings */ -extern char *PLyObject_AsString(PyObject *plrv); +extern "C" char *PLyObject_AsString(PyObject *plrv); =20 #endif /* PLPY_TYPEIO_H */ diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c index 11faa6defe..c3cbd6f69f 100644 --- a/src/pl/tcl/pltcl.c +++ b/src/pl/tcl/pltcl.c @@ -251,7 +251,9 @@ static const TclExceptionNameMap exception_name_map[] = =3D { /********************************************************************** * Forward declarations **********************************************************************/ +extern "C" { void _PG_init(void); +} =20 static void pltcl_init_interp(pltcl_interp_desc *interp_desc, bool pltrust= ed); static pltcl_interp_desc *pltcl_fetch_interp(bool pltrusted); diff --git a/src/test/modules/dummy_seclabel/dummy_seclabel.c b/src/test/mo= dules/dummy_seclabel/dummy_seclabel.c index 7fd78f05c7..fdeeb3325b 100644 --- a/src/test/modules/dummy_seclabel/dummy_seclabel.c +++ b/src/test/modules/dummy_seclabel/dummy_seclabel.c @@ -19,7 +19,7 @@ PG_MODULE_MAGIC; =20 /* Entrypoint of the module */ -void _PG_init(void); +extern "C" void _PG_init(void); =20 PG_FUNCTION_INFO_V1(dummy_seclabel_dummy); =20 diff --git a/src/test/modules/test_rls_hooks/test_rls_hooks.c b/src/test/mo= dules/test_rls_hooks/test_rls_hooks.c index 65bf3e33c9..12a782a919 100644 --- a/src/test/modules/test_rls_hooks/test_rls_hooks.c +++ b/src/test/modules/test_rls_hooks/test_rls_hooks.c @@ -35,8 +35,10 @@ PG_MODULE_MAGIC; static row_security_policy_hook_type prev_row_security_policy_hook_permiss= ive =3D NULL; static row_security_policy_hook_type prev_row_security_policy_hook_restric= tive =3D NULL; =20 +extern "C" { void _PG_init(void); void _PG_fini(void); +} =20 /* Install hooks */ void diff --git a/src/test/modules/test_shm_mq/test.c b/src/test/modules/test_sh= m_mq/test.c index ea3657d5f0..167863afe9 100644 --- a/src/test/modules/test_shm_mq/test.c +++ b/src/test/modules/test_shm_mq/test.c @@ -24,7 +24,7 @@ PG_MODULE_MAGIC; PG_FUNCTION_INFO_V1(test_shm_mq); PG_FUNCTION_INFO_V1(test_shm_mq_pipelined); =20 -void _PG_init(void); +extern "C" void _PG_init(void); =20 static void verify_message(Size origlen, char *origdata, Size newlen, char *newdata); diff --git a/src/test/modules/test_shm_mq/test_shm_mq.h b/src/test/modules/= test_shm_mq/test_shm_mq.h index e76ecab891..cb24007065 100644 --- a/src/test/modules/test_shm_mq/test_shm_mq.h +++ b/src/test/modules/test_shm_mq/test_shm_mq.h @@ -40,6 +40,6 @@ extern void test_shm_mq_setup(int64 queue_size, int32 nwo= rkers, shm_mq_handle **input); =20 /* Main entrypoint for a worker. */ -extern void test_shm_mq_main(Datum) pg_attribute_noreturn(); +extern "C" void test_shm_mq_main(Datum) pg_attribute_noreturn(); =20 #endif diff --git a/src/test/modules/worker_spi/worker_spi.c b/src/test/modules/wo= rker_spi/worker_spi.c index 72ab8464e1..8506a9f621 100644 --- a/src/test/modules/worker_spi/worker_spi.c +++ b/src/test/modules/worker_spi/worker_spi.c @@ -45,7 +45,7 @@ PG_MODULE_MAGIC; =20 PG_FUNCTION_INFO_V1(worker_spi_launch); =20 -void _PG_init(void); +extern "C" void _PG_init(void); void worker_spi_main(Datum) pg_attribute_noreturn(); =20 /* flags set by signal handlers */ diff --git a/src/test/regress/regress.c b/src/test/regress/regress.c index 986d54ce2f..d07514ef55 100644 --- a/src/test/regress/regress.c +++ b/src/test/regress/regress.c @@ -45,8 +45,8 @@ =20 extern PATH *poly2path(POLYGON *poly); extern void regress_lseg_construct(LSEG *lseg, Point *pt1, Point *pt2); -extern char *reverse_name(char *string); -extern int oldstyle_length(int n, text *t); +extern "C" char *reverse_name(char *string); +extern "C" int oldstyle_length(int n, text *t); =20 #ifdef PG_MODULE_MAGIC PG_MODULE_MAGIC; @@ -240,8 +240,10 @@ typedef struct double radius; } WIDGET; =20 +extern "C" { WIDGET *widget_in(char *str); -char *widget_out(WIDGET *widget); +char *widget_out(WIDGET * widget); +} =20 #define NARGS 3 =20 --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0020-Add-C-linkage-to-client-libraries-in-non-systemat.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="v2-0020-Add-C-linkage-to-client-libraries-in-non-systemat.pa"; filename*1="tch" =46rom e345664bbb2b6b25905a8fd4206e8ae1160af4ba Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 20/23] Add C linkage to client libraries in non-systemat= ic ways --- src/backend/utils/mb/encnames.c | 3 +++ src/include/mb/pg_wchar.h | 14 ++++++++++++++ src/include/port.h | 6 ++++++ src/interfaces/ecpg/pgtypeslib/dt.h | 2 +- src/interfaces/libpq/Makefile | 2 +- src/interfaces/libpq/libpq-fe.h | 1 + src/interfaces/libpq/pqexpbuffer.h | 9 +++++++++ 7 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/backend/utils/mb/encnames.c b/src/backend/utils/mb/encname= s.c index 11099b844f..dc62e90bf4 100644 --- a/src/backend/utils/mb/encnames.c +++ b/src/backend/utils/mb/encnames.c @@ -6,6 +6,9 @@ */ #ifdef FRONTEND #include "postgres_fe.h" +#ifdef LIBPQ +#include "libpq-fe.h" +#endif #else #include "postgres.h" #include "utils/builtins.h" diff --git a/src/include/mb/pg_wchar.h b/src/include/mb/pg_wchar.h index ceb5695924..01a89185ec 100644 --- a/src/include/mb/pg_wchar.h +++ b/src/include/mb/pg_wchar.h @@ -437,9 +437,11 @@ typedef uint32 (*utf_local_conversion_func) (uint32 co= de); * These functions are considered part of libpq's exported API and * are also declared in libpq-fe.h. */ +extern "C" { extern int pg_char_to_encoding(const char *name); extern const char *pg_encoding_to_char(int encoding); extern int pg_valid_server_encoding_id(int encoding); +} =20 /* * Remaining functions are not considered part of libpq's API, though many @@ -491,11 +493,23 @@ extern int pg_bind_textdomain_codeset(const char *dom= ainname); #endif =20 extern int pg_valid_client_encoding(const char *name); +#ifdef LIBPQ +extern "C" { +#endif extern int pg_valid_server_encoding(const char *name); +#ifdef LIBPQ +} +#endif =20 extern unsigned char *unicode_to_utf8(pg_wchar c, unsigned char *utf8strin= g); extern pg_wchar utf8_to_unicode(const unsigned char *c); +#ifdef LIBPQ +extern "C" { +#endif extern int pg_utf_mblen(const unsigned char *); +#ifdef LIBPQ +} +#endif extern unsigned char *pg_do_encoding_conversion(unsigned char *src, int le= n, int src_encoding, int dest_encoding); diff --git a/src/include/port.h b/src/include/port.h index 30da8e7d90..82f3eec584 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -467,8 +467,14 @@ extern int pg_check_dir(const char *dir); extern int pg_mkdir_p(char *path, int omode); =20 /* port/pqsignal.c */ +#ifdef LIBPQ +extern "C" { +#endif typedef void (*pqsigfunc) (int signo); extern pqsigfunc pqsignal(int signo, pqsigfunc func); +#ifdef LIBPQ +} +#endif =20 /* port/quotes.c */ extern char *escape_single_quotes_ascii(const char *src); diff --git a/src/interfaces/ecpg/pgtypeslib/dt.h b/src/interfaces/ecpg/pgty= peslib/dt.h index dc711b914b..34f77d761f 100644 --- a/src/interfaces/ecpg/pgtypeslib/dt.h +++ b/src/interfaces/ecpg/pgtypeslib/dt.h @@ -327,7 +327,7 @@ void GetCurrentDateTime(struct tm *); int date2j(int, int, int); void TrimTrailingZeros(char *); void dt2time(double, int *, int *, int *, fsec_t *); -int PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp * d, +extern "C" int PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestam= p * d, int *year, int *month, int *day, int *hour, int *minute, int *second, int *tz); diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile index 4b1e552d16..916f3d2533 100644 --- a/src/interfaces/libpq/Makefile +++ b/src/interfaces/libpq/Makefile @@ -19,7 +19,7 @@ NAME=3D pq SO_MAJOR_VERSION=3D 5 SO_MINOR_VERSION=3D $(MAJORVERSION) =20 -override CPPFLAGS :=3D -DFRONTEND -DUNSAFE_STAT_OK -I$(srcdir) $(CPPFLAGS= ) -I$(top_builddir)/src/port -I$(top_srcdir)/src/port +override CPPFLAGS :=3D -DFRONTEND -DLIBPQ -DUNSAFE_STAT_OK -I$(srcdir) $(= CPPFLAGS) -I$(top_builddir)/src/port -I$(top_srcdir)/src/port ifneq ($(PORTNAME), win32) override CFLAGS +=3D $(PTHREAD_CFLAGS) endif diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-f= e.h index 635af5b50e..2416e5bbfe 100644 --- a/src/interfaces/libpq/libpq-fe.h +++ b/src/interfaces/libpq/libpq-fe.h @@ -505,6 +505,7 @@ extern void PQclear(PGresult *res); extern void PQfreemem(void *ptr); =20 /* Exists for backward compatibility. bjm 2003-03-24 */ +extern void PQfreeNotify(PGnotify *notify); #define PQfreeNotify(ptr) PQfreemem(ptr) =20 /* Error when no password was given. */ diff --git a/src/interfaces/libpq/pqexpbuffer.h b/src/interfaces/libpq/pqex= pbuffer.h index 239def42b7..6cffc4cdd3 100644 --- a/src/interfaces/libpq/pqexpbuffer.h +++ b/src/interfaces/libpq/pqexpbuffer.h @@ -25,6 +25,11 @@ #ifndef PQEXPBUFFER_H #define PQEXPBUFFER_H =20 +#ifdef __cplusplus +extern "C" +{ +#endif + /*------------------------- * PQExpBufferData holds information about an extensible string. * data is the current buffer for the string (allocated with malloc). @@ -179,4 +184,8 @@ extern void appendPQExpBufferChar(PQExpBuffer str, char= ch); extern void appendBinaryPQExpBuffer(PQExpBuffer str, const char *data, size_t datalen); =20 +#ifdef __cplusplus +} +#endif + #endif /* PQEXPBUFFER_H */ --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0021-Hack-Disable-volatile-that-causes-mysterious-comp.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="v2-0021-Hack-Disable-volatile-that-causes-mysterious-comp.pa"; filename*1="tch" =46rom 5b3e003843ebb466791ab9614ae759b986926eac Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 30 Aug 2016 12:00:00 -0400 Subject: [PATCH v2 21/23] Hack: Disable volatile that causes mysterious compiler errors --- src/backend/commands/async.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index e32d7a1d4e..167deaa38b 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -385,7 +385,7 @@ static double asyncQueueUsage(void); static void asyncQueueFillWarning(void); static bool SignalBackends(void); static void asyncQueueReadAllNotifications(void); -static bool asyncQueueProcessPageEntries(volatile QueuePosition *current, +static bool asyncQueueProcessPageEntries(/*volatile*/ QueuePosition *curre= nt, QueuePosition stop, char *page_buffer); static void asyncQueueAdvanceTail(void); @@ -1741,7 +1741,7 @@ ProcessNotifyInterrupt(void) static void asyncQueueReadAllNotifications(void) { - volatile QueuePosition pos; + /*volatile*/ QueuePosition pos; QueuePosition oldpos; QueuePosition head; bool advanceTail; @@ -1901,7 +1901,7 @@ asyncQueueReadAllNotifications(void) * The QueuePosition *current is advanced past all processed messages. */ static bool -asyncQueueProcessPageEntries(volatile QueuePosition *current, +asyncQueueProcessPageEntries(/*volatile*/ QueuePosition *current, QueuePosition stop, char *page_buffer) { --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0022-Add-additional-options-to-silence-warnings-for-C.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename*0="v2-0022-Add-additional-options-to-silence-warnings-for-C.pat"; filename*1="ch" =46rom 2d908996507eacc349d083b1f5dca1684a5c0faa Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 5 Oct 2016 12:00:00 -0400 Subject: [PATCH v2 22/23] Add additional options to silence warnings for C++ --- configure | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ configure.in | 4 +++ 2 files changed, 110 insertions(+) diff --git a/configure b/configure index f0c5356e1f..76e726cdbc 100755 --- a/configure +++ b/configure @@ -4441,6 +4441,112 @@ fi =20 if test "$GCC" =3D yes -a "$ICC" =3D no; then CFLAGS=3D"-Wall -Wpointer-arith" + # C++ support + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -= fpermissive" >&5 +$as_echo_n "checking whether $CC supports -fpermissive... " >&6; } +if ${pgac_cv_prog_cc_cflags__fpermissive+:} false; then : + $as_echo_n "(cached) " >&6 +else + pgac_save_CFLAGS=3D$CFLAGS +CFLAGS=3D"$pgac_save_CFLAGS -fpermissive" +ac_save_c_werror_flag=3D$ac_c_werror_flag +ac_c_werror_flag=3Dyes +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + pgac_cv_prog_cc_cflags__fpermissive=3Dyes +else + pgac_cv_prog_cc_cflags__fpermissive=3Dno +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_c_werror_flag=3D$ac_save_c_werror_flag +CFLAGS=3D"$pgac_save_CFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__= fpermissive" >&5 +$as_echo "$pgac_cv_prog_cc_cflags__fpermissive" >&6; } +if test x"$pgac_cv_prog_cc_cflags__fpermissive" =3D x"yes"; then + CFLAGS=3D"$CFLAGS -fpermissive" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -= Wno-sign-compare" >&5 +$as_echo_n "checking whether $CC supports -Wno-sign-compare... " >&6; } +if ${pgac_cv_prog_cc_cflags__Wno_sign_compare+:} false; then : + $as_echo_n "(cached) " >&6 +else + pgac_save_CFLAGS=3D$CFLAGS +CFLAGS=3D"$pgac_save_CFLAGS -Wno-sign-compare" +ac_save_c_werror_flag=3D$ac_c_werror_flag +ac_c_werror_flag=3Dyes +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + pgac_cv_prog_cc_cflags__Wno_sign_compare=3Dyes +else + pgac_cv_prog_cc_cflags__Wno_sign_compare=3Dno +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_c_werror_flag=3D$ac_save_c_werror_flag +CFLAGS=3D"$pgac_save_CFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__= Wno_sign_compare" >&5 +$as_echo "$pgac_cv_prog_cc_cflags__Wno_sign_compare" >&6; } +if test x"$pgac_cv_prog_cc_cflags__Wno_sign_compare" =3D x"yes"; then + CFLAGS=3D"$CFLAGS -Wno-sign-compare" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -= Wno-write-strings" >&5 +$as_echo_n "checking whether $CC supports -Wno-write-strings... " >&6; } +if ${pgac_cv_prog_cc_cflags__Wno_write_strings+:} false; then : + $as_echo_n "(cached) " >&6 +else + pgac_save_CFLAGS=3D$CFLAGS +CFLAGS=3D"$pgac_save_CFLAGS -Wno-write-strings" +ac_save_c_werror_flag=3D$ac_c_werror_flag +ac_c_werror_flag=3Dyes +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + pgac_cv_prog_cc_cflags__Wno_write_strings=3Dyes +else + pgac_cv_prog_cc_cflags__Wno_write_strings=3Dno +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_c_werror_flag=3D$ac_save_c_werror_flag +CFLAGS=3D"$pgac_save_CFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_cc_cflags__= Wno_write_strings" >&5 +$as_echo "$pgac_cv_prog_cc_cflags__Wno_write_strings" >&6; } +if test x"$pgac_cv_prog_cc_cflags__Wno_write_strings" =3D x"yes"; then + CFLAGS=3D"$CFLAGS -Wno-write-strings" +fi + # not valid for C++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -= Wmissing-prototypes" >&5 $as_echo_n "checking whether $CC supports -Wmissing-prototypes... " >&6; } diff --git a/configure.in b/configure.in index 8099e5c59f..7a676b1bfa 100644 --- a/configure.in +++ b/configure.in @@ -446,6 +446,10 @@ fi =20 if test "$GCC" =3D yes -a "$ICC" =3D no; then CFLAGS=3D"-Wall -Wpointer-arith" + # C++ support + PGAC_PROG_CC_CFLAGS_OPT([-fpermissive]) + PGAC_PROG_CC_CFLAGS_OPT([-Wno-sign-compare]) + PGAC_PROG_CC_CFLAGS_OPT([-Wno-write-strings]) # not valid for C++ PGAC_PROG_CC_CFLAGS_OPT([-Wmissing-prototypes]) # These work in some but not all gcc versions --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/x-patch; name="v2-0023-Fix-issue-with-enums-and-va_arg.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="v2-0023-Fix-issue-with-enums-and-va_arg.patch" =46rom 07dbc4ef099c70af672764bc84e1f7ad9a8c7917 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 5 Oct 2016 12:00:00 -0400 Subject: [PATCH v2 23/23] Fix issue with enums and va_arg() --- src/interfaces/ecpg/ecpglib/descriptor.c | 14 +++++++------- src/interfaces/ecpg/ecpglib/execute.c | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/interfaces/ecpg/ecpglib/descriptor.c b/src/interfaces/ecpg= /ecpglib/descriptor.c index 79a8e4bea5..ef56b5f486 100644 --- a/src/interfaces/ecpg/ecpglib/descriptor.c +++ b/src/interfaces/ecpg/ecpglib/descriptor.c @@ -280,7 +280,7 @@ ECPGget_desc(int lineno, const char *desc_name, int ind= ex,...) ecpg_log("ECPGget_desc: reading items for tuple %d\n", index); --index; =20 - type =3D va_arg(args, enum ECPGdtype); + type =3D va_arg(args, int); =20 memset(&data_var, 0, sizeof data_var); data_var.type =3D ECPGt_EORT; @@ -295,7 +295,7 @@ ECPGget_desc(int lineno, const char *desc_name, int ind= ex,...) enum ECPGttype vartype; void *var; =20 - vartype =3D va_arg(args, enum ECPGttype); + vartype =3D va_arg(args, int); var =3D va_arg(args, void *); varcharsize =3D va_arg(args, long); arrsize =3D va_arg(args, long); @@ -476,7 +476,7 @@ ECPGget_desc(int lineno, const char *desc_name, int ind= ex,...) return (false); } =20 - type =3D va_arg(args, enum ECPGdtype); + type =3D va_arg(args, int); } =20 if (data_var.type !=3D ECPGt_EORT) @@ -603,12 +603,12 @@ ECPGset_desc(int lineno, const char *desc_name, int i= ndex,...) enum ECPGdtype itemtype; char *tobeinserted =3D NULL; =20 - itemtype =3D va_arg(args, enum ECPGdtype); + itemtype =3D va_arg(args, int); =20 if (itemtype =3D=3D ECPGd_EODT) break; =20 - var->type =3D va_arg(args, enum ECPGttype); + var->type =3D va_arg(args, int); var->pointer =3D va_arg(args, char *); =20 var->varcharsize =3D va_arg(args, long); @@ -848,7 +848,7 @@ ECPGdescribe(int line, int compat, bool input, const ch= ar *connection_name, cons void *ptr; =20 /* variable type */ - type =3D va_arg(args, enum ECPGttype); + type =3D va_arg(args, int); =20 if (type =3D=3D ECPGt_EORT) break; @@ -860,7 +860,7 @@ ECPGdescribe(int line, int compat, bool input, const ch= ar *connection_name, cons (void) va_arg(args, long); =20 /* variable indicator */ - (void) va_arg(args, enum ECPGttype); + (void) va_arg(args, int); (void) va_arg(args, void *); /* skip args */ (void) va_arg(args, long); (void) va_arg(args, long); diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ec= pglib/execute.c index bd9b86be49..51429ce05b 100644 --- a/src/interfaces/ecpg/ecpglib/execute.c +++ b/src/interfaces/ecpg/ecpglib/execute.c @@ -1864,7 +1864,7 @@ ecpg_do_prologue(int lineno, const int compat, const = int force_indicator, =20 list =3D &(stmt->inlist); =20 - type =3D va_arg(args, enum ECPGttype); + type =3D va_arg(args, int); =20 while (type !=3D ECPGt_EORT) { @@ -1912,7 +1912,7 @@ ecpg_do_prologue(int lineno, const int compat, const = int force_indicator, =20 var->next =3D NULL; =20 - var->ind_type =3D va_arg(args, enum ECPGttype); + var->ind_type =3D va_arg(args, int); var->ind_pointer =3D va_arg(args, char *); var->ind_varcharsize =3D va_arg(args, long); var->ind_arrsize =3D va_arg(args, long); @@ -1952,7 +1952,7 @@ ecpg_do_prologue(int lineno, const int compat, const = int force_indicator, ptr->next =3D var; } =20 - type =3D va_arg(args, enum ECPGttype); + type =3D va_arg(args, int); } =20 /* are we connected? */ --=20 2.12.0 --------------8B20B2E58236AE0A3510A841 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --------------8B20B2E58236AE0A3510A841-- From andres@anarazel.de Wed Mar 1 06:30:35 2017 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cixmV-0007mU-6l for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Mar 2017 06:30:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cixmU-0007le-7F for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Mar 2017 06:30:34 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cixmJ-0007W5-22 for pgsql-hackers@postgresql.org; Wed, 01 Mar 2017 06:30:23 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cixmF-0005cN-MS for pgsql-hackers@postgresql.org; Wed, 01 Mar 2017 06:30:21 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 6A8DE20A5A; Wed, 1 Mar 2017 01:30:18 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Wed, 01 Mar 2017 01:30:18 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=smtpout; bh=i9woG7KlQorA0g l+Bm/L8iRcWbQ=; b=LPQhsr0i+cc7+DGyr3JB/f7YRxTbzAflR96UDMRb8EBECt wSEfYfY5RiTOxC6EmLCz4nmeJtXK22smA83pxGk6DPTaVVwDUn09+RV21then+9L lZTCyncnJE+Zn+Ilu9UjMxlY++nmsLqquYXZ0IkGlK2uAesLzBgHVq8H1YJYc= X-ME-Sender: X-Sasl-enc: s2sOSDczRFe0mqcIxOY701CBtw732J/WOIhWxQtlx286 1488349818 Received: from intern.anarazel.de (unknown [199.87.86.247]) by mail.messagingengine.com (Postfix) with ESMTPA id 0D1CA7E273; Wed, 1 Mar 2017 01:30:18 -0500 (EST) Date: Tue, 28 Feb 2017 22:30:16 -0800 From: Andres Freund To: Peter Eisentraut Cc: Thomas Munro , Pg Hackers , Jim Nasby Subject: Re: [GENERAL] C++ port of Postgres Message-ID: <20170301063016.o57uv2hxgxysoif4@alap3.anarazel.de> References: <27271.1471366764@sss.pgh.pa.us> <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> <6703fdf2-d0e8-54f5-333a-19220d9a716a@2ndquadrant.com> <20170127034626.frvkfy66hsq3734v@alap3.anarazel.de> <1570c7ca-72e4-7839-29e4-5b30c5d150b4@2ndquadrant.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1570c7ca-72e4-7839-29e4-5b30c5d150b4@2ndquadrant.com> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Hi, On 2017-02-28 23:42:45 -0500, Peter Eisentraut wrote: > On 1/26/17 22:46, Andres Freund wrote: > > On 2016-09-30 15:24:09 -0400, Peter Eisentraut wrote: > >> Yeah, I have committed a few of the patches now and I'll close the CF > >> entry now. Thanks for your research. > > > > Are you planning to push more of these at some point? > > Sure, let's take a look. Cool. > Getting rid of the C++ keywords would open up the possibility of using > -Wc++-compat, which you have expressed interest in, I think. Indeed. And if we go down this path, I'm going to argue that we should add that by default. > Subject: [PATCH v2 01/23] Fix mixup of bool and ternary value > > --- > src/backend/access/gin/ginscan.c | 2 +- > src/include/access/gin_private.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/backend/access/gin/ginscan.c b/src/backend/access/gin/ginscan.c > index c3ce0479c5..c83375d6b4 100644 > --- a/src/backend/access/gin/ginscan.c > +++ b/src/backend/access/gin/ginscan.c > @@ -147,7 +147,7 @@ ginFillScanKey(GinScanOpaque so, OffsetNumber attnum, > key->nuserentries = nUserQueryValues; > > key->scanEntry = (GinScanEntry *) palloc(sizeof(GinScanEntry) * nQueryValues); > - key->entryRes = (bool *) palloc0(sizeof(bool) * nQueryValues); > + key->entryRes = (GinTernaryValue *) palloc0(sizeof(GinTernaryValue) * nQueryValues); > > key->query = query; > key->queryValues = queryValues; > diff --git a/src/include/access/gin_private.h b/src/include/access/gin_private.h > index 34e7339f05..f1f395ac85 100644 > --- a/src/include/access/gin_private.h > +++ b/src/include/access/gin_private.h > @@ -281,7 +281,7 @@ typedef struct GinScanKeyData > int nadditional; > > /* array of check flags, reported to consistentFn */ > - bool *entryRes; > + GinTernaryValue *entryRes; > bool (*boolConsistentFn) (GinScanKey key); > GinTernaryValue (*triConsistentFn) (GinScanKey key); > FmgrInfo *consistentFmgrInfo; That seems like a pretty clear-cut case given the usage of entryRes[i]. > From 7c2f4f31df0eec816d6bb17aa6df2e7f3c6da03e Mon Sep 17 00:00:00 2001 > From: Peter Eisentraut > Date: Tue, 30 Aug 2016 12:00:00 -0400 > Subject: [PATCH v2 02/23] Fix LDFLAGS test for C++ > > The test looks to link to particular function, so we need to make that > function have C linkage. > --- > config/c-compiler.m4 | 9 ++++++++- > configure | 27 ++++++++++++++++++++++++--- > 2 files changed, 32 insertions(+), 4 deletions(-) > > diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 > index 7d901e1f1a..21fb4645c4 100644 > --- a/config/c-compiler.m4 > +++ b/config/c-compiler.m4 > @@ -353,7 +353,14 @@ AC_DEFUN([PGAC_PROG_CC_LDFLAGS_OPT], > AC_CACHE_CHECK([whether $CC supports $1], [Ac_cachevar], > [pgac_save_LDFLAGS=$LDFLAGS > LDFLAGS="$pgac_save_LDFLAGS $1" > -AC_RUN_IFELSE([AC_LANG_PROGRAM([extern void $2 (); void (*fptr) () = $2;],[])], > +AC_RUN_IFELSE([AC_LANG_PROGRAM([#ifdef __cplusplus > +extern "C" { > +#endif > +extern void $2 (); > +#ifdef __cplusplus > +} > +#endif > +void (*fptr) () = $2;],[])], > [Ac_cachevar=yes], > [Ac_cachevar=no], > [Ac_cachevar="assuming no"]) Hm. I'm a bit confused here. The description of PGAC_PROG_CC_LDFLAGS_OPT isn't exactly great: # PGAC_PROG_CC_LDFLAGS_OPT # ------------------------ # Given a string, check if the compiler supports the string as a # command-line option. If it does, add the string to LDFLAGS. doesn't even mention that the second parameter is something kind of required, and what it could be used for. Nor is: # For reasons you'd really rather not know about, this checks whether # you can link to a particular function, not just whether you can link. # In fact, we must actually check that the resulting program runs :-( exactly helpful... But if we accept the premise of the current way to do things, this mostly makes sense. I do wonder if we really should use CC to run a C++ compiler, but ... > From fd5248ca63ce3cf35f22cebd2088c4dfd3d994a4 Mon Sep 17 00:00:00 2001 > From: Peter Eisentraut > Date: Tue, 30 Aug 2016 12:00:00 -0400 > Subject: [PATCH v2 03/23] Add test for -Wmissing-prototypes > > This was part of the hard-coded default warnings set in C, but the > option is not valid for C++ (since prototypes are always required). > > if test "$GCC" = yes -a "$ICC" = no; then > - CFLAGS="-Wall -Wmissing-prototypes -Wpointer-arith" > + CFLAGS="-Wall -Wpointer-arith" > + # not valid for C++ > + PGAC_PROG_CC_CFLAGS_OPT([-Wmissing-prototypes]) > # These work in some but not all gcc versions > PGAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement]) > PGAC_PROG_CC_CFLAGS_OPT([-Wendif-labels]) Makes sense. > From 3447e7cc85c1f2836d882e19952e6db1950a2607 Mon Sep 17 00:00:00 2001 > From: Peter Eisentraut > Date: Tue, 30 Aug 2016 12:00:00 -0400 > Subject: [PATCH v2 04/23] Add necessary type cast > > --- > src/backend/utils/adt/tsginidx.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/backend/utils/adt/tsginidx.c b/src/backend/utils/adt/tsginidx.c > index 83a939dfd5..8f38972676 100644 > --- a/src/backend/utils/adt/tsginidx.c > +++ b/src/backend/utils/adt/tsginidx.c > @@ -309,7 +309,7 @@ gin_tsquery_consistent(PG_FUNCTION_ARGS) > * query. > */ > gcv.first_item = GETQUERY(query); > - gcv.check = check; > + gcv.check = (GinTernaryValue *) check; > gcv.map_item_operand = (int *) (extra_data[0]); > gcv.need_recheck = recheck; > > -- > 2.12.0 k. > From db1807e62dd6ccf358132a7c56ede2531d33336f Mon Sep 17 00:00:00 2001 > From: Peter Eisentraut > Date: Tue, 30 Aug 2016 12:00:00 -0400 > Subject: [PATCH v2 05/23] Rename some typedefs to avoid name conflicts > > C++ does not like that in struct _archiveHandle some of the fields have > the same name as a typedef. This changes the meaning of the typedef in > the scope of the struct, causing warnings and possibly other problems. > > Rename the types so they have names distinct from the struct fields. k. > From 997b09fca65a139af8e73d7e6356739383bd8df1 Mon Sep 17 00:00:00 2001 > From: Peter Eisentraut > Date: Tue, 30 Aug 2016 12:00:00 -0400 > Subject: [PATCH v2 06/23] Reorder some things > > Forward declarations of static variables are not possible in C++, so > move the full definition before its use. k. > From e3393f8f5718b31c4ffe0346edabd8b08a2c7a3f Mon Sep 17 00:00:00 2001 > From: Peter Eisentraut > Date: Tue, 30 Aug 2016 12:00:00 -0400 > Subject: [PATCH v2 07/23] Eliminate C++ keywords > > Remove use of these keywords: class constexpr delete friend namespace > new operator private public template this typeid typename Phew, this is going to be fun. As indicated by the size of this patch, such violations are frequent. I don't think we should commit this without shortly afterwards adding -Wc++-compat or even -Werror=c++-compat, otherwise we'll just continually end up breaking this. > diff --git a/contrib/hstore/hstore.h b/contrib/hstore/hstore.h > index 6bab08b7de..fbedc971c0 100644 > --- a/contrib/hstore/hstore.h > +++ b/contrib/hstore/hstore.h > @@ -188,7 +188,7 @@ extern Pairs *hstoreArrayToPairs(ArrayType *a, int *npairs); > * for now, we default to on for the benefit of people restoring old dumps > */ > #ifndef HSTORE_POLLUTE_NAMESPACE > -#define HSTORE_POLLUTE_NAMESPACE 1 > +#define HSTORE_POLLUTE_NAMESPACE 0 > #endif Doesn't seem like something that should be folded into a patch like this. > diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c > index a38da3047f..302a55a0bf 100644 > --- a/src/backend/catalog/namespace.c > +++ b/src/backend/catalog/namespace.c > @@ -2153,7 +2153,7 @@ TSParserIsVisible(Oid prsId) > { > HeapTuple tup; > Form_pg_ts_parser form; > - Oid namespace; > + Oid prsnamespace; > bool visible; Not yours, but I really do hate the table table prefixes in catalog tables :( > --- a/src/backend/optimizer/geqo/geqo_erx.c > +++ b/src/backend/optimizer/geqo/geqo_erx.c > @@ -281,7 +281,7 @@ static Gene > gimme_gene(PlannerInfo *root, Edge edge, Edge *edge_table) > { > int i; > - Gene friend; > + Gene friend_; friend_gene? Not a fan of underscore ending name. > @@ -869,7 +869,7 @@ boolexpr_startup_fn(Node *clause, PredIterInfo info) > typedef struct > { > OpExpr opexpr; > - Const constexpr; > + Const const_expr; > int next_elem; > int num_elems; > Datum *elem_values; > @@ -913,13 +913,13 @@ arrayconst_startup_fn(Node *clause, PredIterInfo info) > state->opexpr.args = list_copy(saop->args); > > /* Set up a dummy Const node to hold the per-element values */ > - state->constexpr.xpr.type = T_Const; > - state->constexpr.consttype = ARR_ELEMTYPE(arrayval); > - state->constexpr.consttypmod = -1; > - state->constexpr.constcollid = arrayconst->constcollid; > - state->constexpr.constlen = elmlen; > - state->constexpr.constbyval = elmbyval; > - lsecond(state->opexpr.args) = &state->constexpr; > + state->const_expr.xpr.type = T_Const; > + state->const_expr.consttype = ARR_ELEMTYPE(arrayval); > + state->const_expr.consttypmod = -1; > + state->const_expr.constcollid = arrayconst->constcollid; > + state->const_expr.constlen = elmlen; > + state->const_expr.constbyval = elmbyval; > + lsecond(state->opexpr.args) = &state->const_expr; .oO(C++ needs more classes of keywords/col_name_keyword) > diff --git a/src/backend/utils/adt/rangetypes_gist.c b/src/backend/utils/adt/rangetypes_gist.c > index f81b16c236..9f5390f34b 100644 > --- a/src/backend/utils/adt/rangetypes_gist.c > +++ b/src/backend/utils/adt/rangetypes_gist.c > @@ -257,8 +257,8 @@ range_gist_penalty(PG_FUNCTION_ARGS) > GISTENTRY *origentry = (GISTENTRY *) PG_GETARG_POINTER(0); > GISTENTRY *newentry = (GISTENTRY *) PG_GETARG_POINTER(1); > float *penalty = (float *) PG_GETARG_POINTER(2); > - RangeType *orig = DatumGetRangeType(origentry->key); > - RangeType *new = DatumGetRangeType(newentry->key); > + RangeType *origkey = DatumGetRangeType(origentry->key); > + RangeType *newkey = DatumGetRangeType(newentry->key); I guess you renamed orig just for symmetry? Because I don't think it's a keyword? > @@ -663,9 +663,9 @@ RestoreArchive(Archive *AHX) > if ((te->reqs & (REQ_SCHEMA | REQ_DATA)) != 0) > { > /* Show namespace if available */ > - if (te->namespace) > + if (te->schema) Arguable the 'namespace' in the comments should be changed to. But whatever. > diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h > index 81f0db8d3c..ac2ebb7eea 100644 > --- a/src/bin/pg_dump/pg_backup_archiver.h > +++ b/src/bin/pg_dump/pg_backup_archiver.h > @@ -212,7 +212,7 @@ typedef enum > > struct _archiveHandle > { > - Archive public; /* Public part of archive */ > + Archive archive; /* Public part of archive */ > int version; /* Version of file */ > > char *archiveRemoteVersion; /* When reading an archive, the > @@ -342,7 +342,7 @@ struct _tocEntry > bool hadDumper; /* Archiver was passed a dumper routine (used > * in restore) */ > char *tag; /* index tag */ > - char *namespace; /* null or empty string if not in a schema */ > + char *schema; /* null or empty string if not in a schema */ > char *tablespace; /* null if not in a tablespace; empty string > * means use database default */ > char *owner; > @@ -393,10 +393,10 @@ TocEntry *getTocEntryByDumpId(ArchiveHandle *AH, DumpId id); > extern bool checkSeek(FILE *fp); Phew, these are painful due to the widespread impact. Will make backpatching even less fun. But I don't really see an alternative, so we better just get it over. > @@ -265,16 +265,16 @@ SimpleXLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr, > * be done both forward and backward, consider also switching timeline > * accordingly. > */ > - while (private->tliIndex < targetNentries - 1 && > - targetHistory[private->tliIndex].end < targetSegEnd) > - private->tliIndex++; > - while (private->tliIndex > 0 && > - targetHistory[private->tliIndex].begin >= targetSegEnd) > - private->tliIndex--; > + while (private_data->tliIndex < targetNentries - 1 && > + targetHistory[private_data->tliIndex].end < targetSegEnd) > + private_data->tliIndex++; > + while (private_data->tliIndex > 0 && > + targetHistory[private_data->tliIndex].begin >= targetSegEnd) > + private_data->tliIndex--; Hm, isn't this causing a bunch of overlong lines? Which'll then be awkwardly "fixed" by pgindent? Maybe just go for "priv"? > diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h > index 3421eed74f..2193a95f71 100644 > --- a/src/pl/plpgsql/src/plpgsql.h > +++ b/src/pl/plpgsql/src/plpgsql.h > @@ -1078,7 +1078,7 @@ extern PLpgSQL_rec *plpgsql_build_record(const char *refname, int lineno, > extern int plpgsql_recognize_err_condition(const char *condname, > bool allow_sqlstate); > extern PLpgSQL_condition *plpgsql_parse_err_condition(char *condname); > -extern void plpgsql_adddatum(PLpgSQL_datum *new); > +extern void plpgsql_adddatum(PLpgSQL_datum *newdatum); > extern int plpgsql_add_initdatums(int **varnos); > extern void plpgsql_HashTableInit(void); > > @@ -1104,7 +1104,7 @@ extern Oid plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate, > PLpgSQL_datum *datum); > extern void plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate, > PLpgSQL_datum *datum, > - Oid *typeid, int32 *typmod, Oid *collation); > + Oid *typid, int32 *typmod, Oid *collation); Hm, this one (and a bunch of others) should have been caught earlier, but cpluspluscheck was too centered in src/include... Admittedly those are probably more important, given that one is more likely to include them directly. Wee, through that one. That must have been a fun one to write > From 7c18f989d0dc430059cce70e5f0e634e18705b91 Mon Sep 17 00:00:00 2001 > From: Peter Eisentraut > Date: Tue, 30 Aug 2016 12:00:00 -0400 > Subject: [PATCH v2 08/23] Set up for static asserts in C++ > > --- > src/include/c.h | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/src/include/c.h b/src/include/c.h > index 947bd98067..7f303a4f39 100644 > --- a/src/include/c.h > +++ b/src/include/c.h > @@ -744,14 +744,26 @@ typedef NameData *Name; > * about a negative width for a struct bit-field. This will not include a > * helpful error message, but it beats not getting an error at all. > */ > +#ifdef __cplusplus > +#if __cpp_static_assert >= 200410 > +#define _Static_assert(condition, errmessage) static_assert(condition, errmessage) > +#define HAVE__STATIC_ASSERT 1 > +#endif > +#endif A comment about why we're doing this seems appropriate. > From dadbc472a1e06f2b17b758f24827ba431d499cee Mon Sep 17 00:00:00 2001 > From: Peter Eisentraut > Date: Tue, 30 Aug 2016 12:00:00 -0400 > Subject: [PATCH v2 09/23] Fix function prototypes for C++ > > C++ needs to have the right number of arguments in function signatures. Ok. > From 454f463597d4732883c163b92f62494a282b9dc8 Mon Sep 17 00:00:00 2001 > From: Peter Eisentraut > Date: Tue, 30 Aug 2016 12:00:00 -0400 > Subject: [PATCH v2 10/23] Fix fmgr_oldstyle for C++ > > C++ needs the function pointer to have the right number of arguments, so > some casts are needed here. I've a lingering patch to just remove fmgr_oldstyle, that seems preferrable to this. > From 47a7faf131bbee1e56f31220253798f955b05d65 Mon Sep 17 00:00:00 2001 > From: Peter Eisentraut > Date: Tue, 30 Aug 2016 12:00:00 -0400 > Subject: [PATCH v2 11/23] Don't define bool in C++ > > --- > src/test/thread/thread_test.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/src/test/thread/thread_test.c b/src/test/thread/thread_test.c > index cb93bcc5ab..7ee0991988 100644 > --- a/src/test/thread/thread_test.c > +++ b/src/test/thread/thread_test.c > @@ -24,6 +24,8 @@ > #include "postgres.h" > #else > /* From src/include/c.h" */ > +#ifndef __cplusplus > + > #ifndef bool > typedef char bool; > #endif > @@ -37,6 +39,8 @@ typedef char bool; > #endif > #endif > > +#endif > + I wonder if we shouldn't also use stdbool.h type booleans if available. > From 6c22f8b7f692d4fe26f807453a2b97993db4cae0 Mon Sep 17 00:00:00 2001 > From: Peter Eisentraut > Date: Tue, 30 Aug 2016 12:00:00 -0400 > Subject: [PATCH v2 12/23] Change TimeoutId from enum to integer > > RegisterTimeout() treats it like an integer. C++ doesn't like enums to > be treated that way. > -typedef enum TimeoutId > -{ > +typedef int TimeoutId; > + > /* Predefined timeout reasons */ > - STARTUP_PACKET_TIMEOUT, > - DEADLOCK_TIMEOUT, > - LOCK_TIMEOUT, > - STATEMENT_TIMEOUT, > - STANDBY_DEADLOCK_TIMEOUT, > - STANDBY_TIMEOUT, > - STANDBY_LOCK_TIMEOUT, > - IDLE_IN_TRANSACTION_SESSION_TIMEOUT, > +const int STARTUP_PACKET_TIMEOUT = 1; > +const int DEADLOCK_TIMEOUT = 2; > +const int LOCK_TIMEOUT = 3; > +const int STATEMENT_TIMEOUT = 4; > +const int STANDBY_DEADLOCK_TIMEOUT = 5; > +const int STANDBY_TIMEOUT = 6; > +const int STANDBY_LOCK_TIMEOUT = 7; > +const int IDLE_IN_TRANSACTION_SESSION_TIMEOUT = 8; > /* First user-definable timeout reason */ > - USER_TIMEOUT, > +const int USER_TIMEOUT = 9; > /* Maximum number of timeout reasons */ > - MAX_TIMEOUTS = 16 > -} TimeoutId; > +const int MAX_TIMEOUTS = 16; I dislike this one a fair bit. On some stupid compilers you're going to emit actual symbols with this. We could just cast in RegisterTimeout()? (skipping to 23 here) > From 07dbc4ef099c70af672764bc84e1f7ad9a8c7917 Mon Sep 17 00:00:00 2001 > From: Peter Eisentraut > Date: Wed, 5 Oct 2016 12:00:00 -0400 > Subject: [PATCH v2 23/23] Fix issue with enums and va_arg() Seems reasonable. - Andres -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From andres@anarazel.de Wed Apr 5 23:14:53 2017 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cvuAB-000883-NA for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Apr 2017 23:16:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cvuAB-0006Di-6R for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Apr 2017 23:16:31 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cvu8f-0003RI-NE for pgsql-hackers@postgresql.org; Wed, 05 Apr 2017 23:14:57 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cvu8d-0007V2-9z for pgsql-hackers@postgresql.org; Wed, 05 Apr 2017 23:14:56 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 7A40D20C68; Wed, 5 Apr 2017 19:14:54 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Wed, 05 Apr 2017 19:14:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=/ACzDajda1E/z6UgA0 UOMTlPcxWTKMpwoxvG133ejdU=; b=fZvvCDv4jncHZ5hNLDAVFt6QFfwhrTf2w6 uB0P4LrOJv0tRoGNH/O3bHI854pH/EUhoygHMjWHKZK6ndsx4t3TWLOn9O8zmxol oatJ7qsYfSq5pRjKOXkUtXJukIW3knb77VKZdkMiPNpBvHn63NoU7MYlCCGdQBak J0uKzrlkneb8m+Mg+jERYc4MXtxsGN5V6MQ8FZgNRSnhc/HyfiZrhat4hdzcnvPp 6LyeG7YFLoFS9v+Svm8acWK1P7WuIXjzUbYlDX0J4oiJHgkSPKoYQiHdBBSR645M Y7aviLs6T4xiDv4Ztl8hegImAXnkIPGe0Vh7k1bgJBpzAZ3ZbM7Q== X-ME-Sender: X-Sasl-enc: G0ZogPcT8rCAK+Z5PqmjITo7O8GJLzOM9vL8eNQnph4n 1491434094 Received: from intern.anarazel.de (unknown [208.72.138.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 302442400E; Wed, 5 Apr 2017 19:14:54 -0400 (EDT) Date: Wed, 5 Apr 2017 16:14:53 -0700 From: Andres Freund To: Peter Eisentraut Cc: Thomas Munro , Pg Hackers , Jim Nasby Subject: Re: [GENERAL] C++ port of Postgres Message-ID: <20170405231453.ecqi2t75hxj3vlsb@alap3.anarazel.de> References: <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> <6703fdf2-d0e8-54f5-333a-19220d9a716a@2ndquadrant.com> <20170127034626.frvkfy66hsq3734v@alap3.anarazel.de> <1570c7ca-72e4-7839-29e4-5b30c5d150b4@2ndquadrant.com> <20170301063016.o57uv2hxgxysoif4@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170301063016.o57uv2hxgxysoif4@alap3.anarazel.de> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Hi Peter, On 2017-02-28 22:30:16 -0800, Andres Freund wrote: > On 2017-02-28 23:42:45 -0500, Peter Eisentraut wrote: > > On 1/26/17 22:46, Andres Freund wrote: > > > On 2016-09-30 15:24:09 -0400, Peter Eisentraut wrote: > > >> Yeah, I have committed a few of the patches now and I'll close the CF > > >> entry now. Thanks for your research. > > > > > > Are you planning to push more of these at some point? > > > > Sure, let's take a look. > [ partial review ] Are you planning to get any of this into v10? There's one or two patches here that could qualify as bugfixes (the GinTernary stuff), but the rest doesn't strike me as something that should be committed at the tail end of the merge window. Regards, Andres -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers From peter.eisentraut@2ndquadrant.com Thu Apr 6 18:23:47 2017 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cwC61-0007hg-Vn for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Apr 2017 18:25:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cwC60-0003Rm-Uc for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Apr 2017 18:25:24 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cwC4W-0000jf-2r for pgsql-hackers@postgresql.org; Thu, 06 Apr 2017 18:23:52 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cwC4T-0004Zk-Rl for pgsql-hackers@postgresql.org; Thu, 06 Apr 2017 18:23:50 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 93A1D20DCF; Thu, 6 Apr 2017 14:23:48 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Thu, 06 Apr 2017 14:23:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=aKt6DDKhP5aWpyod6qpM+mOwF/pqlFw12UR/yjS4OvA=; b=cg0g/ENg pGlk50SIoEcR7JaeYKyDRSWOn+ZcylntWts/b+zOY7DtbX+lJpvzSsKyVBkqDc4r nPZkR5feabVtgm0YUGcJNOhgrm5YwTFc5wmtCrj1oDlUsYz22b6alVc7NAg9ZSfk pqzSuqAP2L8tQBhx26XkfTbP/hSUs9UOe3/txz2uWz0ZXtFB/RfJJHr8iydeBjNN an0KaxGaoToSUdwrFjhrJaVypHs2OyNvph8UkV/DocVmO83mAaihiFwVVdtz7Q5w 4+1UAqOQUoxgGbgvStpuD59bKokbImL4hdX78U2A6MIvhw6jWcgpkMZWe5uAiX41 IrGjh68aD4+JZw== X-ME-Sender: X-Sasl-enc: U7d4TD0Li8tjxoLFXg0t8vnMfwm3Kj7A4iqvEP3scR/e 1491503028 Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id 47B8024457; Thu, 6 Apr 2017 14:23:48 -0400 (EDT) Subject: Re: [GENERAL] C++ port of Postgres To: Andres Freund References: <66b61d8b-fe76-d4a9-a983-93a94444a2a6@BlueTreble.com> <6703fdf2-d0e8-54f5-333a-19220d9a716a@2ndquadrant.com> <20170127034626.frvkfy66hsq3734v@alap3.anarazel.de> <1570c7ca-72e4-7839-29e4-5b30c5d150b4@2ndquadrant.com> <20170301063016.o57uv2hxgxysoif4@alap3.anarazel.de> <20170405231453.ecqi2t75hxj3vlsb@alap3.anarazel.de> Cc: Thomas Munro , Pg Hackers , Jim Nasby From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: Date: Thu, 6 Apr 2017 14:23:47 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170405231453.ecqi2t75hxj3vlsb@alap3.anarazel.de> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 4/5/17 19:14, Andres Freund wrote: > Hi Peter, > > On 2017-02-28 22:30:16 -0800, Andres Freund wrote: >> On 2017-02-28 23:42:45 -0500, Peter Eisentraut wrote: >>> On 1/26/17 22:46, Andres Freund wrote: >>>> On 2016-09-30 15:24:09 -0400, Peter Eisentraut wrote: >>>>> Yeah, I have committed a few of the patches now and I'll close the CF >>>>> entry now. Thanks for your research. >>>> >>>> Are you planning to push more of these at some point? >>> >>> Sure, let's take a look. >> [ partial review ] > > Are you planning to get any of this into v10? There's one or two > patches here that could qualify as bugfixes (the GinTernary stuff), but > the rest doesn't strike me as something that should be committed at the > tail end of the merge window. Done. I'll keep refining the keywords issue based on your feedback. That might be something to look into early in PG11. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers