PQregisterSubClasses(3)
π PQregisterSubClasses β libpqtypes manual, bestie edition π
okay so this one lives in the libpqtypes manual, and it's literally about teaching your Postgres connection about β¨aliasesβ¨ and sub-classes of types. adorable concept, slightly deprecated execution, we'll get to that π«Ά
β¨ NAME β¨
PQregisterSubClasses β registers type aliases or sub-classes. that's the whole vibe π
πΈ SYNOPSIS πΈ
#include <libpqtypes.h>
int PQregisterSubClasses(PGconn *conn, PGregisterType *types,
int count);
π DEPRECATED π
ok so THIS FUNCTION IS DEPRECATED. like, fully. not me being dramatic, it says so in the header.
new applications should use PQregisterTypes instead. this function is now just a wrapper to PQregisterTypes β it's giving "still shows up to the party but stands in the corner" π
π¦ DESCRIPTION π¦
the PQregisterSubClasses() function lets an application register an alias or a sub-class of another type. it's basically type nepotism, and honestly? slay.
the types argument is an array containing count sub class types to register. so like, you're handing it a whole lil squad of types at once π
the typname member of the PGregisterType structure must specify an inheritance relationship. example:
"myint=int4"
where myint inherits from int4. the = is called the inheritence operator (yes, spelled exactly like that, keep it that way, no cap).
if both the typput and typget members of the PGregisterType structure are NULL, the type at that element will behave identically to the type it is inheriting from β that's what we call an alias. periodt.
otherwise, the base type's put and/or get routines will be overridden. you're not just copying the look, you're customizing the fit π
NOTE: thetypnamemember of thePGregisterTypestructure can optionally contain the type's schema, written asschema.typname. cute, organized, we love a namespace.
WARNING: PQparamCreate is only aware of types that have already been registered. if you need to put a type into a param, make sure it is first registered. like, register it BEFORE, bestie. the order matters. don't come crying to me when your param doesn't know what type it is π
π RETURN VALUE π
- on success, a non-zero value is returned. ate. π
- on error, zero is returned, and
PQgeterror(3)will contain an error message so you can find out what went wrong π΅οΈ
π EXAMPLES π
None.
(it literally says none. i'm not gonna make one up for you, that would be lying and lying is not the vibe π§)
π AUTHOR π
a contribution of eSilo, LLC. for the PostgreSQL Database Management System. written by Andrew Chernow and Merlin Moncure. absolute icons, we stan π
π REPORTING BUGS π
found a bug? report bugs to <libpqtypes@esilo.com>. they wanna hear about it fr fr π¬
β COPYRIGHT β
Copyright (c) 2011 eSilo, LLC. All rights reserved.
this is free software; see the source for copying conditions. there is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. so like, no guarantees, bestie, you're on your own π«Ά
π§ SEE ALSO π§
and that's the whole page!! π this was libpqtypes, version 2011, page PQregisterSubClasses(3) β thanks for reading, go register some types, mwah ππ
β¨
π¦ where this page comes from
- debian bookworm: libpqtypes-dev 1.5.1-9
- ubuntu jammy: libpqtypes-dev 1.5.1-7
- ubuntu noble: libpqtypes-dev 1.5.1-9.1build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms