Opened 5 years ago

Closed 5 years ago

#4312 closed defect (duplicate)

PostgreSQL 12 broken - error: unknown type name ‘FunctionCallInfoData

Reported by: robe Owned by: pramsey
Priority: blocker Milestone: PostGIS 3.0.0
Component: postgis Version: master
Keywords: Cc:

Description

Getting these on Debbie's PostgreSQL 12 git run - I'm retesting again since the regular run failed last time for a different reason.

-c -o lwgeom_transform.o lwgeom_transform.c
In file included from lwgeom_transform.c:27:
lwgeom_cache.h:106:37: error: unknown type name ‘FunctionCallInfoData’; did you mean ‘FunctionCallInfoBaseData’?
 PROJ4PortalCache*  GetPROJ4SRSCache(FunctionCallInfoData *fcinfo);
                                     ^~~~~~~~~~~~~~~~~~~~
                                     FunctionCallInfoBaseData
lwgeom_cache.h:107:33: error: unknown type name ‘FunctionCallInfoData’; did you mean ‘FunctionCallInfoBaseData’?
 GeomCache*         GetGeomCache(FunctionCallInfoData *fcinfo, const GeomCacheMethods* cache_methods, const GSERIALIZED* g1, const GSERIALIZED* g2);
                                 ^~~~~~~~~~~~~~~~~~~~
                                 FunctionCallInfoBaseData
lwgeom_transform.c: In function ‘GetPROJ4Cache’:
lwgeom_transform.c:679:21: warning: implicit declaration of function ‘GetPROJ4SRSCache’; did you mean ‘GetPROJ4Cache’? [-Wimplicit-function-declaration]
  return (Proj4Cache)GetPROJ4SRSCache(fcinfo);
                     ^~~~~~~~~~~~~~~~
                     GetPROJ4Cache
lwgeom_transform.c:679:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  return (Proj4Cache)GetPROJ4SRSCache(fcinfo);
         ^

This particular error looks like it started happening after PostgreSQL upstream commit

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=a9c35cf85ca1ff72f16f0f10d7ddee6e582b62b8

Commit a9c35cf85ca1ff72f16f0f10d7ddee6e582b62b8 by andres

Change function call information to be variable length.
Before this change FunctionCallInfoData, the struct arguments etc for V1
function calls are stored in, always had space for FUNC_MAX_ARGS/100
arguments, storing datums and their nullness in two arrays.  For nearly
every function call 100 arguments is far more than needed, therefore
wasting memory. Arg and argnull being two separate arrays also
guarantees that to access a single argument, two cachelines have to be
touched.
Change the layout so there's a single variable-length array with pairs 
of value / isnull. That drastically reduces memory consumption for most
function calls (on x86-64 a two argument function now uses 64bytes,
previously 936 bytes), and makes it very likely that argument value and
its nullness are on the same cacheline.
Arguments are stored in a new NullableDatum struct, which, due to 
padding, needs more memory per argument than before. But as usually far
fewer arguments are stored, and individual arguments are cheaper to
access, that's still a clear win.  It's likely that there's other places
where conversion to NullableDatum arrays would make sense, e.g.
TupleTableSlots, but that's for another commit.
Because the function call information is now variable-length allocations
have to take the number of arguments into account. For heap allocations
that can be done with SizeForFunctionCallInfoData(), for on-stack
allocations there's a new LOCAL_FCINFO(name, nargs) macro that helps to
allocate an appropriately sized and aligned variable.
Some places with stack allocation function call information don't know 
the number of arguments at compile time, and currently variably sized 
stack allocations aren't allowed in postgres. Therefore allow for 
FUNC_MAX_ARGS space in these cases. They're not that common, so for now
that seems acceptable.
Because of the need to allocate FunctionCallInfo of the appropriate 
size, older extensions may need to update their code. To avoid subtle 
breakages, the FunctionCallInfoData struct has been renamed to 
FunctionCallInfoBaseData. Most code only references FunctionCallInfo, so
that shouldn't cause much collateral damage.
This change is also a prerequisite for more efficient expression JIT 
compilation (by allocating the function call information on the stack, 
allowing LLVM to optimize it away); previously the size of the call 
information caused problems inside LLVM's optimizer.
Author: Andres Freund Reviewed-By: Tom Lane Discussion:
https://postgr.es/m/20180605172952.x34m5uz6ju6enaem@alap3.anarazel.de

Change History (2)

comment:1 by robe, 5 years ago

Summary: PostgreSQL 12 brokenPostgreSQL 12 broken - error: unknown type name ‘FunctionCallInfoData

comment:2 by Algunenano, 5 years ago

Resolution: duplicate
Status: newclosed

Duplicated in https://trac.osgeo.org/postgis/ticket/4313

I'm closing this one since the other has a patch available.

Note: See TracTickets for help on using tickets.