1 /*-------------------------------------------------------------------------
2  *
3  * pg_conversion.h
4  *	  definition of the "conversion" system catalog (pg_conversion)
5  *
6  * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * src/include/catalog/pg_conversion.h
10  *
11  * NOTES
12  *	  The Catalog.pm module reads this file and derives schema
13  *	  information.
14  *
15  *-------------------------------------------------------------------------
16  */
17 #ifndef PG_CONVERSION_H
18 #define PG_CONVERSION_H
19 
20 #include "catalog/genbki.h"
21 #include "catalog/objectaddress.h"
22 #include "catalog/pg_conversion_d.h"
23 
24 /* ----------------
25  *		pg_conversion definition.  cpp turns this into
26  *		typedef struct FormData_pg_conversion
27  * ----------------
28  */
29 CATALOG(pg_conversion,2607,ConversionRelationId)
30 {
31 	/* oid */
32 	Oid			oid;
33 
34 	/* name of the conversion */
35 	NameData	conname;
36 
37 	/* namespace that the conversion belongs to */
38 	Oid			connamespace BKI_DEFAULT(PGNSP);
39 
40 	/* owner of the conversion */
41 	Oid			conowner BKI_DEFAULT(PGUID);
42 
43 	/* FOR encoding id */
44 	int32		conforencoding BKI_LOOKUP(encoding);
45 
46 	/* TO encoding id */
47 	int32		contoencoding BKI_LOOKUP(encoding);
48 
49 	/* OID of the conversion proc */
50 	regproc		conproc BKI_LOOKUP(pg_proc);
51 
52 	/* true if this is a default conversion */
53 	bool		condefault BKI_DEFAULT(t);
54 } FormData_pg_conversion;
55 
56 /* ----------------
57  *		Form_pg_conversion corresponds to a pointer to a tuple with
58  *		the format of pg_conversion relation.
59  * ----------------
60  */
61 typedef FormData_pg_conversion *Form_pg_conversion;
62 
63 
64 extern ObjectAddress ConversionCreate(const char *conname, Oid connamespace,
65 									  Oid conowner,
66 									  int32 conforencoding, int32 contoencoding,
67 									  Oid conproc, bool def);
68 extern void RemoveConversionById(Oid conversionOid);
69 extern Oid	FindDefaultConversion(Oid connamespace, int32 for_encoding,
70 								  int32 to_encoding);
71 
72 #endif							/* PG_CONVERSION_H */
73