[GENERAL] Get user defined type OID (PostgreSQL extension in C) - Mailing list pgsql-general

From Fabiana Zioti
Subject [GENERAL] Get user defined type OID (PostgreSQL extension in C)
Date
Msg-id CP1PR80MB07417E55E182E8E5681D0D3FFD9B0@CP1PR80MB0741.lamprd80.prod.outlook.com
Whole thread Raw
Responses Re: [GENERAL] Get user defined type OID (PostgreSQL extension in C)  (Melvin Davidson <melvin6925@gmail.com>)
Re: [GENERAL] Get user defined type OID (PostgreSQL extension in C)  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-general

 

I'm developing an extension to PostgreSQL using C. I created a user-defined type called geo_trajc_elem. I also created a function to generate an array of this new type.

 
(....)

  ArrayType *result_array;
  struct geo_trajc_elem *traje = (struct geo_trajc_elem *)palloc(sizeof(struct geo_trajc_elem));

  Timestamp time_el = PG_GETARG_TIMESTAMP(1);
  struct geo_point *pt = PG_GETARG_GEOPOINT_TYPE_P(2);

  int16 typlen;
  bool typbyval;
  char typalign;

  Datum datum_element;


  traje = DatumGetGeoTrajETypeP(DirectFunctionCall2(get_trajectory_elem, PointerGetDatum(time_el), PointerGetDatum(pt)));
  datum_element = PointerGetDatum(traje);

  /* Oid element_type = get_fn_expr_argtype(fcinfo->flinfo, 0); */

  Oid element_type = ?

  get_typlenbyvalalign(element_type, &typlen, &typbyval, &typalign);
(....)


Is there a function to get the id of my new type? Like get_oid_elem (struct geo_trajc_elem)

In this case, it is not possible to use get_fn_expr_argtype because I am not passing the new type as argument but creating it in the function itself, correct ?

pgsql-general by date:

Previous
From: "Peter J. Holzer"
Date:
Subject: Re: [GENERAL] Porting libpq to QNX 4.25
Next
From: marcelo
Date:
Subject: Re: [GENERAL] Porting libpq to QNX 4.25