Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nOfgp-0001p0-AV for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Feb 2022 13:03:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nOfgo-0007bW-6D for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Feb 2022 13:03:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nOfgn-0007bN-Sr for pgsql-hackers@lists.postgresql.org; Mon, 28 Feb 2022 13:03:45 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nOfgl-0002kU-Ng for pgsql-hackers@lists.postgresql.org; Mon, 28 Feb 2022 13:03:44 +0000 Received: by mail-wr1-x42b.google.com with SMTP id p9so15303096wra.12 for ; Mon, 28 Feb 2022 05:03:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CaMEeRJqVJJ2XxBwVALppK9RxusHnv7uVwGos33LBXk=; b=hDN/MIbSRpLaLMfDDmMQRvGzWBMleCQg3/hOaUvvw7KK8QDy2if7qCBcsJXGKLJRUB ju1MB7+M40BljJw0O0IPzrzfq4mM/xw884zMAduVg6CYr6mZghiVS7XDtvrW3XShOR3t 4kvIEF6aF3NoXOKSZNY82m05oUUNjt6seSizIbjfu7g5MH//eRoa4ZMwmL75IxfC1n17 T8ucrQJFcaYIr48A4vCRvKIYKA7dS/owWZJFF6IQDIkLLdyMeHBNzhsAyKX2qn4FUSpZ 8+9pc46PO4SLFcSw5eOuoPhaKD+p3yEOuj1m5I1Q5UiFNNcH6jrYI5d4iaZ0C2/7s72B ND1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CaMEeRJqVJJ2XxBwVALppK9RxusHnv7uVwGos33LBXk=; b=rY863IbOhm1z0sdGR3x0eUi44sX69sOcE+lxkZsamIW7bVpbLnT/uebW+LAnv88e2Z wsTAUL4YNE/FuM6exFYGb7YHdsl0EpW01O56FzQgib/rz+0r8gn3QWi1U7CvQJ/RDSZX 77MTk92y66nHaLJpHU2szU03LSL6YyIsRDSNxU80VbYvTBP40BsuOa8z+IGjF+4mg98o E5e3e3oJdEOHn8YR0g3HrV8bsjyJ6biTXQ/FMHLI7cFvgwq+pMS0sOBJK9wYLO1V0NHA bbZtkQe1HR1+a0ZLt2Kd23fCEKNlTUZ84Sbo6hBUvbhyXepx6r+OOQ02m+OjqWpAJqM8 4rug== X-Gm-Message-State: AOAM5321zdsHdzMWNmTIzGIuSRinbGVCBYk11GM/PedJUDCxj2oFSJlD nwqrfvIzZEfxGVRtgSTRYVYHxbqrT6iJ4ZrRvB8= X-Google-Smtp-Source: ABdhPJzcmUQqGi4M0zTaM34Nkd4zhgPa7b+MaHNi19NRanCeHIM63mWya6xJW3IZ9dIY55pSb8oC6XYgleMcnqIQGeo= X-Received: by 2002:a5d:5446:0:b0:1ed:c29c:1a4d with SMTP id w6-20020a5d5446000000b001edc29c1a4dmr15707441wrv.46.1646053422326; Mon, 28 Feb 2022 05:03:42 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ashutosh Bapat Date: Mon, 28 Feb 2022 18:33:30 +0530 Message-ID: Subject: Re: real/float example for testlibpq3 To: Mark Wong Cc: PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Mark, Fetching a "real" type field from libpq doesn't look that intuitive. So this example is super helpful. Thanks. I am wondering whether we should provide PQgetfloatvalue() which does what that example shows but transparently. It will return a float value of the given field instead of char *. That will standardize the way to fetch real typed values in libpq. That leads to the next question. Do we need to introduce different PQget*value() for standard C/SQL data types. -- Best Wishes, Ashutosh Bapat On Fri, Feb 25, 2022 at 3:12 AM Mark Wong wrote: > > Hi everyone, > > Would adding additional examples to testlibpq3.c on handling more data > types be helpful? I've attached a patch adding how to handle a REAL to > current example. > > Regards, > Mark