@Igor_Petrovv

Как сделать, чтобы расширение было перемещаемым?

Я не знаю, как сделать расширение перемещаемым. Вопрос: как сделать расширение перемещаемым в другую схему. Ниже описано начало. После этого происходит создание операторов, функций, дисперсий, математического ожидания.
create schema IF NOT EXISTS complex;

--Математическое ожидание
--создание комплексного типа данных
create type complex.complex as (re float, im float);
--создание комплексного типа данных с суммой комплексных чисел и количеством чисел
create type complex.complexSumAndCount as (complexSumVar complex.complex, complexCount integer);

--Создание функции сложения комплексных чисел
CREATE or REPLACE function complex.complexSumFunction (sum complex.complex, complexTempVar complex.complex)
    RETURNS complex.complex as
$$
BEGIN

    IF sum is not null and complexTempVar is not null then
        sum.re := coalesce(sum.re, 0) + coalesce(complexTempVar.re, 0);
        sum.im := coalesce(sum.im, 0) + coalesce(complexTempVar.im, 0);
    end IF;

    RETURN sum;
end;
$$
    LANGUAGE plpgSQL;
  • Вопрос задан
  • 73 просмотра
Решения вопроса 1
Melkij
@Melkij
PostgreSQL DBA
https://www.postgresql.org/docs/current/extend-ext...
A fully relocatable extension can be moved into another schema at any time, even after it's been loaded into a database. This is done with the ALTER EXTENSION SET SCHEMA command, which automatically renames all the member objects into the new schema. Normally, this is only possible if the extension contains no internal assumptions about what schema any of its objects are in. Also, the extension's objects must all be in one schema to begin with (ignoring objects that do not belong to any schema, such as procedural languages). Mark a fully relocatable extension by setting relocatable = true in its control file.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы