On 09/18/17 23:39, Magnus Johansson wrote:
Hello,

I'm looking on FB 3.0 and doing some thinking comparing with FB 2.5.

In 2.5 there is an index on RDB$USERS.RDB$USER_NAME and that field is defined 
as VARCHAR.
In 3.0 there is no index on SEC$USERS.SEC$USER_NAME and it is defined as CHAR.

Looking further in 3.0,
PLG$SRP.PLG$USER_NAME and PLG$USERS.PLG$USER_NAME both has indexes and are 
defined as VARCHAR.
RDB$AUTH_MAPPING.RDB$MAP_NAME also has an index but is defined as CHAR.

I'm curious about why there is no index on SEC$USERS.SEC$USER_NAME (*)

You are right - because it's virtual table.

and about the reason as to why there is a difference between the usage of 
VARCHAR and CHAR on tables that seems related.

Use of CHAR for system tables is typical solution. What about related fields in tables used by plugins - they are logically related, but separated by plugin code and plugin is free to choose any format to store that data. One can write plugin that stores user's list in non-firebird database or even in text file.

And if there would have been an index, would a UNIQUE INDEX on SEC$USERS 
(SEC$USER_NAME, SEC$PLUGIN) been correct?

If virtual table _could_ have indices - yes, that pair is unique.

If these kinds of question don't belong here then I apologize, else it would be 
most appreciated if anyone with some insight and time over care to enlighten me.

(*)
I first thought that it had to do with SEC$USERS being a virtual table 
materialized on execution for that transaction.
Then I read a little in UserManagement.h about getting users list for SEC$USERS from 
security database for deferred work, and although I realize that "security 
database" here can be any database I got uncertain.
So being a Delphi guy only I probably miss the point but I have to ask probably 
stupid question with obvious answers.

Regards,
Magnus Johansson

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to