st 21. 5. 2025 v 2:21 odesÃlatel Michael Paquier <mich...@paquier.xyz> napsal:
> On Tue, May 20, 2025 at 10:28:31PM +0200, Pavel Stehule wrote: > > This topic is difficult, because there is no common solution. SQL/PSM is > > almost dead. T-SQL (and MySQL) design is weak and cannot be used for > > security. > > Oracle's design is joined with just one environment. And although almost > > all widely used databases have supported session variables for decades, > no > > one design > > is perfect. Proposed design is not perfect too (it introduces possible > > ambiguity) , but I think it can support most wanted use cases (can be > > enhanced in future), > > and it is consistent with Postgres. There are more ways to reduce risk of > > unwanted ambiguity to zero. But it increases the size of the patch. > > One thing that I keep hearing about this feature is that this would be > really helpful for migration from Oracle to PostgreSQL, helping a lot > with rewrites of pl/pgsql functions. > > There is one page on the wiki about private variables, dating back to > 2016: > https://wiki.postgresql.org/wiki/CREATE_PRIVATE_VARIABLE > > I wrote mail https://www.postgresql.org/message-id/cafj8prb8kdwqcdn2x1_63c58+07oy4z+rudk_xptup+pe8r...@mail.gmail.com and there is another wiki page https://wiki.postgresql.org/wiki/Variable_Design > Perhaps it would help to summarize a bit the pros and cons of existing > implementations to drive which implementation would be the most suited > on a wiki page? The way standards are defined is by overwriting > existing standards, and we don't have one in the SQL specification. > It's hard to say if there will be one at some point, but if the main > SQL products around the world have one, it pretty much is a point in > favor of having a standard. > Although it is maybe a peccant idea - I can imagine two different implementations of server side session variables with different syntaxes (and different advantages and disadvantages, and different use cases). The implementations are not going against, but we should to accept fact, so one feature is implemented twice. We should choose just one, that will be implemented first. Proposed helps with migration from PL/SQL. > > Another possible angle that could be taken is to invest in a proposal > for the SQL committee to consider, forcing an actual standard that > PostgreSQL could rely on rather than having one behavior implemented > to have it standard-incompatible a few years after. And luckily, we > have Vik Fearing and Peter Eisentraut in this community who invest > time and resources in this area. > Theoretically the proposed design is a subset of implementation from DB2 - I designed it without knowledge of this DB2 feature. But without introduction of concept of modules (that is partially redundant to schemas), this design is very natural and I am very sure, so there is not another way, how to design it. We can ask Peter or Vik about real possibilities in this area. I have not any information from this area, just I haven't seen the changes in SQL/PSM for decades, so I didn't think about it. > FWIW, I do agree with the opinion that if you want to propose rebased > versions of this patch set on a periodic basis, you are free to do so. > This is the core concept of an open community. In terms of my > committer time, I'm pretty much already booked in terms of features > planned for the next release, so I guess that I won't be able to > invest time on this thread. Just saying. > thank you for an info > I know that this patch set has been discussed at FOSDEM at some point, > so others may be able to comment more about that. That's just one > opinion among many others. > -- > Michael >