pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #13404: Docs do not mention "access/htup_details.h" for C functions using heap_form_tuple
3+ messages / 3 participants
[nested] [flat]

* BUG #13404: Docs do not mention "access/htup_details.h" for C functions using heap_form_tuple
@ 2015-06-05 19:53  christianr@fastmail.com
  0 siblings, 1 reply; 3+ messages in thread

From: christianr@fastmail.com @ 2015-06-05 19:53 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      13404
Logged by:          Christian Reinke
Email address:      christianr@fastmail.com
PostgreSQL version: 9.4.2
Operating system:   Linux
Description:        

Bug report regarding: PostgreSQL 9.4.2 Documentation (in HTML format)
                      Section 35.9. C-Language Functions
                      Section 35.9.8. Returning Rows (Composite Types)

PostgreSQL version: 9.4.2.

Debian packages: postgresql-9.4, postgresql-doc-9.4,
postgresql-server-dev-9.4,
                 etc., all version 9.4.2-0+deb8u1.

Platform: Linux ... 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt9-3~deb8u1
          (2015-04-24) x86_64 GNU/Linux.

I tried to compile a C-language function that uses the function
heap_form_tuple and got a warning because its declaration was missing:

gcc -I/usr/include/postgresql/9.4/server -Wall -c -fpic -lm -g test1.c
test1.c: In function ‘test1’:
test1.c:246:3: warning: implicit declaration of function ‘heap_form_tuple’
[-Wimplicit-function-declaration]
   result_tuple = heap_form_tuple (result_tuple_desc, dat, isnull);
   ^
   
test1.c compiled without this warning under PostgreSQL 9.1.

test1.c included the following PostgreSQL header files:
#include "postgres.h"
#include "fmgr.h"
#include "funcapi.h"
#include "executor/executor.h"

test1.c compiles successfully under PostgreSQL 9.4 if I, also, include:
#include "access/htup_details.h"

PostgreSQL 9.1 included the declaration of heap_form_tuple along the
sequence funcapi.h, executor/tuptable.h and access/htup.h.  In
PostgreSQL 9.4, the declaration of heap_form_tuple moved from
access/htup.h to a new header file access/htup_details.h, which is not
included by funcapi.h.

The HTML documentation, however, seems to say in Section 35.9.8. that it
is sufficient to include funcapi.h to get all the definitions required
for functions returning rows (composite types).

Is this a bug, or did I miss something?



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #13404: Docs do not mention "access/htup_details.h" for C functions using heap_form_tuple
@ 2015-06-05 21:50  Alvaro Herrera <alvherre@2ndquadrant.com>
  parent: christianr@fastmail.com
  0 siblings, 1 reply; 3+ messages in thread

From: Alvaro Herrera @ 2015-06-05 21:50 UTC (permalink / raw)
  To: christianr@fastmail.com; +Cc: pgsql-bugs

christianr@fastmail.com wrote:

> PostgreSQL 9.1 included the declaration of heap_form_tuple along the
> sequence funcapi.h, executor/tuptable.h and access/htup.h.  In
> PostgreSQL 9.4, the declaration of heap_form_tuple moved from
> access/htup.h to a new header file access/htup_details.h, which is not
> included by funcapi.h.
> 
> The HTML documentation, however, seems to say in Section 35.9.8. that it
> is sufficient to include funcapi.h to get all the definitions required
> for functions returning rows (composite types).
> 
> Is this a bug, or did I miss something?

Hmm.  So there are two ways to fix this bug.  One is to #include
"access/htup_details.h" in funcapi.h as you propose; the other is to
change the docs to state that heap_form_tuple is in htup_details and you
need to include that separately if you want it.

I could go both ways, but seeing as we changed this in 9.3 and many
people since then first complained and then tweaked their code to cope
by #including htup_details.h, I think changing the docs is the reasonable
option.  You can write functions without using heap_form_tuple, after
all.

Other opinions?

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #13404: Docs do not mention "access/htup_details.h" for C functions using heap_form_tuple
@ 2015-06-05 22:36  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Alvaro Herrera <alvherre@2ndquadrant.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2015-06-05 22:36 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: christianr@fastmail.com; pgsql-bugs

Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> christianr@fastmail.com wrote:
>> Is this a bug, or did I miss something?

> Hmm.  So there are two ways to fix this bug.  One is to #include
> "access/htup_details.h" in funcapi.h as you propose; the other is to
> change the docs to state that heap_form_tuple is in htup_details and you
> need to include that separately if you want it.

> I could go both ways, but seeing as we changed this in 9.3 and many
> people since then first complained and then tweaked their code to cope
> by #including htup_details.h, I think changing the docs is the reasonable
> option.  You can write functions without using heap_form_tuple, after
> all.

Yeah.  I don't think anyone's ever felt that that part of the
documentation was more authoritative than the code (especially not where
it's merely reporting an old and rather messy situation).  And as you say,
if we were going to change the code, the time for that was 2 releases
back.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2015-06-05 22:36 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-06-05 19:53 BUG #13404: Docs do not mention "access/htup_details.h" for C functions using heap_form_tuple christianr@fastmail.com
2015-06-05 21:50 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2015-06-05 22:36   ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox