Re: Schema variables - new implementation for Postgres 15

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: Schema variables - new implementation for Postgres 15
Дата
Msg-id CAFj8pRCbmmDQ2itZ_0CnAPheaxhiP+iepMcv+6Z44UPCKStn8w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Schema variables - new implementation for Postgres 15  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
Hi


You can see, the RDBMS allows different types of session variables, different implementations. Usually one system allows more implementation of session variables. There is a possibility of emulation implementation between RDBMS, but security setting is possible only in Oracle or DB2.

MySQL concept is very handy for ad hoc work, but it is too primitive for secure or safe use in stored procedures.

Oracle concept is safe, but needs packages, needs writing wrappers, needs PL/SQL.

I designed a concept that is very similar to DB2 (independently on IBM), and I think it is strong and can be well mapped to PostgreSQL (no packages, more different PL, strongly typed, ...)

I think it would be nice to support the MySQL concept as syntactic sugar for GUC. This can be easy and for some use cases really very handy (and less confusing for beginners - using set_confing and current_setting is intuitive for work (emulation) of session variables (although the MSSQL solution is less intuitive).

SET @myvar TO 10; --> SELECT set_config('session.myvar', 10)
SET @@work_mem TO '10MB'; --> SELECT set_config('work_mem', '10MB');
SELECT @myvar; --> SELECT current_setting('session.myvar');
SELECT @@work_mem; --> SELECT current_setting('work_mem');

The syntax @ and @@ is widely used, and the mapping can be simple. This my proposal is not a replacement of the proposal of "schema" session variables. It is another concept, and I think so both can live together very well, because they are used for different purposes. Oracle, DB2 supports +/- both concepts

Regards

Pavel



 

Regards

Pavel






В списке pgsql-hackers по дате отправления:

Предыдущее
От: Masahiko Sawada
Дата:
Сообщение: Revive num_dead_tuples column of pg_stat_progress_vacuum
Следующее
От: Erik Wienhold
Дата:
Сообщение: Re: pltcl crashes due to a syntax error