Header And Logo

PostgreSQL
| The world's most advanced open source database.

Functions | Variables

pg_upgrade_support.c File Reference

#include "postgres.h"
#include "catalog/namespace.h"
#include "catalog/pg_type.h"
#include "commands/extension.h"
#include "miscadmin.h"
#include "utils/array.h"
#include "utils/builtins.h"
Include dependency graph for pg_upgrade_support.c:

Go to the source code of this file.

Functions

Datum set_next_pg_type_oid (PG_FUNCTION_ARGS)
Datum set_next_array_pg_type_oid (PG_FUNCTION_ARGS)
Datum set_next_toast_pg_type_oid (PG_FUNCTION_ARGS)
Datum set_next_heap_pg_class_oid (PG_FUNCTION_ARGS)
Datum set_next_index_pg_class_oid (PG_FUNCTION_ARGS)
Datum set_next_toast_pg_class_oid (PG_FUNCTION_ARGS)
Datum set_next_pg_enum_oid (PG_FUNCTION_ARGS)
Datum set_next_pg_authid_oid (PG_FUNCTION_ARGS)
Datum create_empty_extension (PG_FUNCTION_ARGS)
 PG_FUNCTION_INFO_V1 (set_next_pg_type_oid)
 PG_FUNCTION_INFO_V1 (set_next_array_pg_type_oid)
 PG_FUNCTION_INFO_V1 (set_next_toast_pg_type_oid)
 PG_FUNCTION_INFO_V1 (set_next_heap_pg_class_oid)
 PG_FUNCTION_INFO_V1 (set_next_index_pg_class_oid)
 PG_FUNCTION_INFO_V1 (set_next_toast_pg_class_oid)
 PG_FUNCTION_INFO_V1 (set_next_pg_enum_oid)
 PG_FUNCTION_INFO_V1 (set_next_pg_authid_oid)
 PG_FUNCTION_INFO_V1 (create_empty_extension)

Variables

PGDLLIMPORT Oid binary_upgrade_next_pg_type_oid
PGDLLIMPORT Oid binary_upgrade_next_array_pg_type_oid
PGDLLIMPORT Oid binary_upgrade_next_toast_pg_type_oid
PGDLLIMPORT Oid binary_upgrade_next_heap_pg_class_oid
PGDLLIMPORT Oid binary_upgrade_next_index_pg_class_oid
PGDLLIMPORT Oid binary_upgrade_next_toast_pg_class_oid
PGDLLIMPORT Oid binary_upgrade_next_pg_enum_oid
PGDLLIMPORT Oid binary_upgrade_next_pg_authid_oid

Function Documentation

Datum create_empty_extension ( PG_FUNCTION_ARGS   ) 

Definition at line 145 of file pg_upgrade_support.c.

References DatumGetTextPP, deconstruct_array(), get_extension_oid(), get_namespace_oid(), GetUserId(), i, InsertExtensionTuple(), lappend_oid(), NULL, PG_ARGISNULL, PG_GETARG_ARRAYTYPE_P, PG_GETARG_BOOL, PG_GETARG_DATUM, PG_GETARG_TEXT_PP, PG_RETURN_VOID, PointerGetDatum, text_to_cstring(), and TEXTOID.

{
    text       *extName = PG_GETARG_TEXT_PP(0);
    text       *schemaName = PG_GETARG_TEXT_PP(1);
    bool        relocatable = PG_GETARG_BOOL(2);
    text       *extVersion = PG_GETARG_TEXT_PP(3);
    Datum       extConfig;
    Datum       extCondition;
    List       *requiredExtensions;

    if (PG_ARGISNULL(4))
        extConfig = PointerGetDatum(NULL);
    else
        extConfig = PG_GETARG_DATUM(4);

    if (PG_ARGISNULL(5))
        extCondition = PointerGetDatum(NULL);
    else
        extCondition = PG_GETARG_DATUM(5);

    requiredExtensions = NIL;
    if (!PG_ARGISNULL(6))
    {
        ArrayType  *textArray = PG_GETARG_ARRAYTYPE_P(6);
        Datum      *textDatums;
        int         ndatums;
        int         i;

        deconstruct_array(textArray,
                          TEXTOID, -1, false, 'i',
                          &textDatums, NULL, &ndatums);
        for (i = 0; i < ndatums; i++)
        {
            text       *txtname = DatumGetTextPP(textDatums[i]);
            char       *extName = text_to_cstring(txtname);
            Oid         extOid = get_extension_oid(extName, false);

            requiredExtensions = lappend_oid(requiredExtensions, extOid);
        }
    }

    InsertExtensionTuple(text_to_cstring(extName),
                         GetUserId(),
                       get_namespace_oid(text_to_cstring(schemaName), false),
                         relocatable,
                         text_to_cstring(extVersion),
                         extConfig,
                         extCondition,
                         requiredExtensions);

    PG_RETURN_VOID();
}

PG_FUNCTION_INFO_V1 ( set_next_pg_type_oid   ) 
PG_FUNCTION_INFO_V1 ( set_next_pg_enum_oid   ) 
PG_FUNCTION_INFO_V1 ( set_next_pg_authid_oid   ) 
PG_FUNCTION_INFO_V1 ( set_next_toast_pg_class_oid   ) 
PG_FUNCTION_INFO_V1 ( create_empty_extension   ) 
PG_FUNCTION_INFO_V1 ( set_next_array_pg_type_oid   ) 
PG_FUNCTION_INFO_V1 ( set_next_toast_pg_type_oid   ) 
PG_FUNCTION_INFO_V1 ( set_next_heap_pg_class_oid   ) 
PG_FUNCTION_INFO_V1 ( set_next_index_pg_class_oid   ) 
Datum set_next_array_pg_type_oid ( PG_FUNCTION_ARGS   ) 
Datum set_next_heap_pg_class_oid ( PG_FUNCTION_ARGS   ) 
Datum set_next_index_pg_class_oid ( PG_FUNCTION_ARGS   ) 
Datum set_next_pg_authid_oid ( PG_FUNCTION_ARGS   ) 
Datum set_next_pg_enum_oid ( PG_FUNCTION_ARGS   ) 
Datum set_next_pg_type_oid ( PG_FUNCTION_ARGS   ) 
Datum set_next_toast_pg_class_oid ( PG_FUNCTION_ARGS   ) 
Datum set_next_toast_pg_type_oid ( PG_FUNCTION_ARGS   ) 

Variable Documentation

Definition at line 88 of file typecmds.c.

Referenced by AssignTypeArrayOid(), and set_next_array_pg_type_oid().

Definition at line 77 of file heap.c.

Referenced by heap_create_with_catalog(), and set_next_heap_pg_class_oid().

Definition at line 72 of file index.c.

Referenced by index_create(), and set_next_index_pg_class_oid().

Definition at line 41 of file user.c.

Referenced by CreateRole(), and set_next_pg_authid_oid().

Definition at line 34 of file pg_enum.c.

Referenced by AddEnumLabel(), and set_next_pg_enum_oid().

Definition at line 39 of file pg_type.c.

Referenced by set_next_pg_type_oid(), TypeCreate(), and TypeShellMake().

Definition at line 36 of file toasting.c.

Referenced by create_toast_table(), and set_next_toast_pg_type_oid().