Re: How to extract a value from a record using attnum or attname?

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>
Cc: "Dimitri Fontaine" <dimitri(at)2ndquadrant(dot)fr>, "Andrew Dunstan" <andrew(at)dunslane(dot)net>, "pgsql-hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: How to extract a value from a record using attnum or attname?
Date: 2011-02-23 19:20:16
Message-ID: 4D650990020000250003AF1E@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)com> wrote:

> Why not use quote_identifier and quote_literal_cstr instead of
> this new strcpy thing?

We've got various types of software that will be parsing these
payloads, and it's a little easier to parse if the quoting is
unconditional. If that's a barrier to acceptance we could use
the functions which quote conditionally and adjust our regular
expressions.

Probably one reason we had a bias toward quoting is that every
single application table name we use has at least on uppercase
letter and about 95% of our column names do.

> Also, you don't really need spi.h do you?

It's using these functions:

SPI_getrelname
SPI_fname
SPI_getvalue

If there's a better way to get the info, I'm game.

-Kevin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Glaesemann 2011-02-23 19:40:22 Re: Data types for IP address.
Previous Message John R Pierce 2011-02-23 18:49:33 Re: Data types for IP address.

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Chernow 2011-02-23 19:21:08 Re: Correctly producing array literals for prepared statements
Previous Message Robert Haas 2011-02-23 18:56:29 Re: disposition of remaining patches