Re: [Firebird-devel] isc_database_info and current database user

2019-02-28 Thread Alex Peshkoff via Firebird-devel

On 3/1/19 12:40 AM, Adriano dos Santos Fernandes wrote:


Grouped by user name of what connection pool already is configured for:
the user name to connect.


Certainly. Mapped user name has nothing to do with connection pool.


Why would anyone need the mapped user name instead of the already known
user name used to make the connection?



For example to ask - hey, dba, please grant execute on procedure X to 
user Y.





Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] isc_database_info and current database user

2019-02-28 Thread Mark Rotteveel

On 2019-02-28 20:57, Adriano dos Santos Fernandes wrote:

On 28/02/2019 16:54, Mark Rotteveel wrote:


The same can be asked for a lot of other information items that can be
obtained from isc_database_info. And the answer is invariably: because
it can be useful for an application or a driver itself to obtain that
information.



Why it could be necessary for a driver?

A feature request needs a requirement.


The requirement on Firebird is "the client (driver) wants to get the 
actual user name in an efficient manner". What you seem to want is the 
underlying rationale for that requirement (or the requirement on the 
driver to have that requirement on Firebird).


One such requirement could be that the driver wants to fulfill something 
like the JDBC api requirements of DatabaseMetaData.getUserName() 
("Retrieves the user name as known to this database.", 
https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#getUserName-- 
). Jaybird currently uses the username it connected with, but in the 
Firebird 3 situation of mapped users that is technically no longer 
correct. In addition, if I ever implement trusted auth in Jaybird, or 
some other form of authentication where the username is unknown to the 
driver, then the incorrectness of the current implementation is even 
greater.


And, yes, I can use CURRENT_USER, especially as I think this isn't a 
method that will be used a lot, though I might be wrong. I can also 
envision situations where others might have a need where performance is 
of a greater importance. There the overhead of having to start a 
transaction, create/prepare a statement, execute, fetch, close/drop 
statement and end the transaction, might be too great compared to a 
single isc_database_info request, especially if that might get executed 
anyway as part of establishing the connection (which means near zero 
overhead if you can add an extra info item to an existing 
isc_database_info request).


Mark


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] isc_database_info and current database user

2019-02-28 Thread Adriano dos Santos Fernandes
On 28/02/2019 17:09, Dimitry Sibiryakov wrote:
> 28.02.2019 20:42, Adriano dos Santos Fernandes wrote:
>> Then the question: for what the client would need to known the mapped
>> user name?
> 
>   The simplest example: connection pool must grouped by user name
> because currently there is no way to change current user of already
> established connection. (Role can be changed.)
> 
> 

Grouped by user name of what connection pool already is configured for:
the user name to connect.

Why would anyone need the mapped user name instead of the already known
user name used to make the connection?


Adriano


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] isc_database_info and current database user

2019-02-28 Thread Dimitry Sibiryakov

28.02.2019 20:42, Adriano dos Santos Fernandes wrote:

Then the question: for what the client would need to known the mapped
user name?


  The simplest example: connection pool must grouped by user name because currently there 
is no way to change current user of already established connection. (Role can be changed.)



--
  WBR, SD.


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] isc_database_info and current database user

2019-02-28 Thread Adriano dos Santos Fernandes
On 28/02/2019 16:54, Mark Rotteveel wrote:
>
> The same can be asked for a lot of other information items that can be
> obtained from isc_database_info. And the answer is invariably: because
> it can be useful for an application or a driver itself to obtain that
> information.
>

Why it could be necessary for a driver?

A feature request needs a requirement.


Adriano



Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] isc_database_info and current database user

2019-02-28 Thread Mark Rotteveel

On 2019-02-28 20:42, Adriano dos Santos Fernandes wrote:

On 28/02/2019 16:20, Mark Rotteveel wrote:


As far as I understand it, if you use the Firebird 3 mapping feature,
than you can remap the login and role of any user to an entirely
different user.

So, as far as I know, a client no longer knows what the actual user
is, even if it used username and password authentication.



Then the question: for what the client would need to known the mapped
user name?


The same can be asked for a lot of other information items that can be 
obtained from isc_database_info. And the answer is invariably: because 
it can be useful for an application or a driver itself to obtain that 
information.


Mark


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] isc_database_info and current database user

2019-02-28 Thread Adriano dos Santos Fernandes
On 28/02/2019 16:20, Mark Rotteveel wrote:
>
> As far as I understand it, if you use the Firebird 3 mapping feature,
> than you can remap the login and role of any user to an entirely
> different user.
>
> So, as far as I know, a client no longer knows what the actual user
> is, even if it used username and password authentication.
>

Then the question: for what the client would need to known the mapped
user name?


Adriano



Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] isc_database_info and current database user

2019-02-28 Thread Mark Rotteveel

On 28-2-2019 13:00, Alex Peshkoff via Firebird-devel wrote:

On 2/28/19 2:15 PM, Kovalenko Dmitry wrote:

Can you explain - what a problem with use of SQL to get that data?

Need start (and commit) implicit transaction.

For me - it is not good behavior of provider.


For RORC I can't say for sure that this is too bad behavior. But as a 
minimum getInfo() requires less calls to server.


What is RORC?

Am I understanding correctly that with FB3 you can't trust passed login 
& role any more?


As far as I understand it, if you use the Firebird 3 mapping feature, 
than you can remap the login and role of any user to an entirely 
different user.


So, as far as I know, a client no longer knows what the actual user is, 
even if it used username and password authentication.


Mark
--
Mark Rotteveel


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] isc_database_info and current database user

2019-02-28 Thread Alex Peshkoff via Firebird-devel

On 2/28/19 2:15 PM, Kovalenko Dmitry wrote:

Can you explain - what a problem with use of SQL to get that data?

Need start (and commit) implicit transaction.

For me - it is not good behavior of provider.


For RORC I can't say for sure that this is too bad behavior. But as a 
minimum getInfo() requires less calls to server.


Am I understanding correctly that with FB3 you can't trust passed login 
& role any more?




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] isc_database_info and current database user

2019-02-28 Thread Kovalenko Dmitry
> Can you explain - what a problem with use of SQL to get that data?

Need start (and commit) implicit transaction.

For me - it is not good behavior of provider.

Dmitry Kovalenko.



Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] isc_database_info and current database user

2019-02-28 Thread liviuslivius
No, you can have e.g. windows autentication
Regards,Karol Bieniaszewski
nullFirebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] isc_database_info and current database user

2019-02-28 Thread Alex Peshkoff via Firebird-devel

On 2/28/19 1:46 PM, Adriano dos Santos Fernandes wrote:

On 28/02/2019 05:30, Kovalenko Dmitry wrote:

select current_user from rdb$database

Usage of similar queries is not good idea for connection provider.

It is problem to added new info-tags (current_user and, may be,
current_role) for isc_database_info in FB3.0.5?

 From my side I will added the special support for these new tags into my
provider.



Who pass the user is who connects, so you should already known it at
client side.


Server may contain various mapping rules which can easily cause 
current_user != passed login. The value of current_role which also 
depends upon mapping is interesting for the same reason.

Can you explain - what a problem with use of SQL to get that data?




Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] isc_database_info and current database user

2019-02-28 Thread Adriano dos Santos Fernandes
On 28/02/2019 05:30, Kovalenko Dmitry wrote:
>> select current_user from rdb$database
> Usage of similar queries is not good idea for connection provider.
>
> It is problem to added new info-tags (current_user and, may be,
> current_role) for isc_database_info in FB3.0.5?
>
> From my side I will added the special support for these new tags into my
> provider.
>
>
Who pass the user is who connects, so you should already known it at
client side.


Adriano



Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] isc_database_info and current database user

2019-02-28 Thread Kovalenko Dmitry
> select current_user from rdb$database

Usage of similar queries is not good idea for connection provider.

It is problem to added new info-tags (current_user and, may be,
current_role) for isc_database_info in FB3.0.5?

>From my side I will added the special support for these new tags into my
provider.

Dmitry Kovalenko.



Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel