PQregisterSubClasses(3)

πŸ“¦ version 1.5.1, in debian bookworm, ubuntu jammy, ubuntu noble

πŸ’– 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: the typname member of the PGregisterType structure can optionally contain the type's schema, written as schema.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 (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