Use session variable as reference to session user on PostgreSQL session I would like to build an authorization system to handle role-based permission within the database itself.  Basically, I want my application user to have different access. The problem of basing this on Postgresql users is that if my application has millions of users, then I must have million of Postgresql users with potentially different connection parameters every time, making unable to use any kind of connection pooling (stop me if I am wrong).  So instead I thought I should base this on roles, but since roles don't have much effect on row security (which is my primary purpose here), I can just go on and create a session variable containing the user identification upon querying. Meaning if I want to do a select on some table. My application (actually a REST API) would do the following:  SET SESSION app.user = 'my user' SELECT * from table   It would add the SET SESSION for every request to the database. If table has the proper row security, this would get the rows from table that belongs to 'my user'  I want to know if this solution makes sense and if I understood the concept of SQL session properly, any big performance impact to expect?  Edit: The question  describes the details implementation on how to go about implementing a full authorization system. I want to know if I can use a session variable, to identify my user and reuse it somewhere later in my query, instead of just using role to identify a specific user. I changed the title to make this clearer.
set session - custom variable to store user id I want to store user id in custom session variable and use it (read) in trigger procedures to authorize user actions. I found something like this:  set session "myapp.user" = '12345'; ... SELECT current_setting('myapp.user');   and it seems to work - I thought that "myapp.user" should be declared in .conf file but it seems that I can create session variables on the fly (I didn't change .conf file at all).  Is there any disadvantage of doing like this?
What do ref, val and out mean on method parameters? I'm looking for a clear, concise and accurate answer.    Ideally as the actual answer, although links to good explanations welcome.  This also applies to VB.Net, but the keywords are different - ByRef and ByVal. What's the easiest way to set up a LAMP stack? Problem with long chapter title and arsclassica Why can `root` run any command as any user without providing password? My /etc/sudoershas content:  Defaults        env_reset Defaults        mail_badpass Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"  # Host alias specification  # User alias specification  # Cmnd alias specification  # User privilege specification root    ALL=(ALL:ALL) ALL  # Members of the admin group may gain root privileges %admin ALL=(ALL) ALL  # Allow members of group sudo to execute any command %sudo   ALL=(ALL:ALL) ALL  # See sudoers(5) for more information on "#include" directives:  #includedir /etc/sudoers.d   There is no rule above specifying NOPASSWD. I was wondering  why user root seem to be able to execute any command as any user without providing password?  Thanks. What are the effects of exceptions on performance in Java? Question:  Is exception handling in Java actually slow?  Conventional wisdom, as well as a lot of Google results, says that exceptional logic shouldn't be used for normal program flow in Java.  Two reasons are usually given,   it is really slow - even an order of magnitude slower than regular code (the reasons given vary),     and    it is messy because people expect only errors to be handled in exceptional code.     This question is about #1.  As an example,  describes Java exception handling as "very slow" and relates the slowness to the creation of the exception message string - "this string is then used in creating the exception object that is thrown. This is not fast."  The article  says that "the reason for this is due to the object creation aspect of exception handling, which thereby makes throwing exceptions inherently slow".  Another reason out there is that the stack trace generation is what slows it down.  My testing (using Java 1.6.0_07, Java HotSpot 10.0, on 32 bit Linux), indicates that exception handling is no slower than regular code.  I tried running a method in a loop that executes some code.  At the end of the method, I use a boolean to indicate whether to return or throw.  This way the actual processing is the same. I tried running the methods in different orders and averaging my test times, thinking it may have been the JVM warming up.  In all my tests, the throw was at least as fast as the return, if not faster (up to 3.1% faster).  I am completely open to the possibility that my tests were wrong, but I haven't seen anything out there in the way of the code sample, test comparisons, or results in the last year or two that show exception handling in Java to actually be slow.  What leads me down this path was an API I needed to use that threw exceptions as part of normal control logic.  I wanted to correct them in their usage, but now I may not be able to.  Will I instead have to praise them on their forward thinking?  In the paper , the authors suggest that the presence of exception handlers alone, even if no exceptions are thrown, is enough to prevent the JIT compiler from optimizing the code properly, thus slowing it down.  I haven't tested this theory yet. Converting Older United States Dollar Bills I received from my Dad 150 American Dollars about 12 years ago. I never have thought to change this money but a few days I tried change it in a currency exchange in Sydney and the guy didn't change it because the series are old.     What do I have to do to change this money? How to convert a 3 column csv file into a table (or matrix) I have an CSV input file format like this, with a nucleotide sequence in field 1, text in field 2, and an integer in field 4:  ATGC,CD3,56 ATGC,CD4,67 ATGC,IgD,126 ATGC,IgM,127 AGTC,CD3,67 AGTC,CD4,78 AGTC,IgD,102 AGTC,IgM,89 TCGA,CD3,334 TCGA,CD4,123 TCGA,IgD,456 TCGA,IgM,80 CGTA,CD3,54 CGTA,CD4,32 CGTA,IgD,82 CGTA,IgM,117   I opened this CSV file using Numbers in Mac it's display as 3 columns format, however, I want to convert it to the table(or Matrix) format (also a CSV file), making the first column, the nucleotide sequences, into a header, and want the result to also look like a table (or Matrix):       ATGC  AGTC  TCGA  CGTA CD3  56    67    334   54 CD4  67    78    123   32 IgD  126   102   456   82 IgM  127   89    80    117   Below is a section from my real input CSV file (sample input.txt):  AGAATAGTCTGATTCT,-,,38 AGAATAGTCTGATTCT,AnnexinV,,51 AGAATAGTCTGATTCT,CD127,,39 AGAATAGTCTGATTCT,CD138,,3 AGAATAGTCTGATTCT,CD14,,2 AGAATAGTCTGATTCT,CD16,,4 AGAATAGTCTGATTCT,CD19,,10 AGAATAGTCTGATTCT,CD20,,6 AGAATAGTCTGATTCT,CD24,,21 AGAATAGTCTGATTCT,CD25,,4 AGAATAGTCTGATTCT,CD27,,87 AGAATAGTCTGATTCT,CD3,,235 AGAATAGTCTGATTCT,CD34,,5 AGAATAGTCTGATTCT,CD38,,18 AGAATAGTCTGATTCT,CD4,,412 AGAATAGTCTGATTCT,CD43,,99 AGAATAGTCTGATTCT,CD5,,430 AGAATAGTCTGATTCT,CD56,,3 AGAATAGTCTGATTCT,CD8,,7 AGAATAGTCTGATTCT,IgD,,4 AGAATAGTCTGATTCT,IgM,,2 TGTGGTAGTTCGTCTC,-,,9 TGTGGTAGTTCGTCTC,AnnexinV,,42 TGTGGTAGTTCGTCTC,CD127,,6 TGTGGTAGTTCGTCTC,CD138,,4 TGTGGTAGTTCGTCTC,CD16,,40 TGTGGTAGTTCGTCTC,CD19,,7 TGTGGTAGTTCGTCTC,CD20,,2 TGTGGTAGTTCGTCTC,CD24,,24 TGTGGTAGTTCGTCTC,CD25,,2   How can I do this using Linux text formatting commands? "any other verbs then being located in VP" -- is this acceptable? if the sentence you are analysing contains a modal verb, then it is positioned in ‘I’,any other verbs then being located in VP.      (English Syntax and Argumentation - Bas Aarts)   At first, I think the The bold clause should be "...is located..." but then I realize it might be in the form of a non-finite clause (ing clause with a subject) but I'm not sure. If it isn't, how you describe this usage? Is this common in English? You should choose your Display Name when signing up What is the volatile keyword useful for? If $(a,b)=1$ then prove $(a+b, ab)=1$. Is there an issue tracker for already reported Mathematica bugs? MicroSD card is set to Read-only state. How can I write data on it? How should we handle a question which was deleted and reasked? A user has asked  which did not receive much attention, and thus the user deleted the post. After some time, the user asked the  (with just slight changes to the title and a tag change), so that it could receive a bit more attention. The strange thing is that the question was not downvoted or poorly written, and yet the user deleted the original post. Now, since the original question was deleted, I could not mark the new one as a duplicate (it threw an error). My question is, how do we handle such questions? Just let them be as such or let the user know about it or is there another way to handle such situations? Generalizing the case $p=2$ we would like to know if the statement below is true.  Let $p$ the smallest prime dividing the order of $G$. If $H$ is a subgroup of $G$ with index $p$ then $H$ is normal. Where are static variables stored in C and C++? A 256GB SSD has Windows-10 and 16.04 installed.  BIOS not UEFI.  A charity I work with requires me to use Quickbooks Desktop on Windows.  The plan is to ghost the existing system to a 512GB or larger SSD and create a third bootable Windows 7  partition for performing charity activities.   Is this possible to have a third partition? Is there a good example you have used as a guide? Is triple booting with two Windows partitions different from 2 Linux partitions?   If you have done this before ( with GRUB) please indicate this in your response: lessons-learned are appreciated.  Thank you You can also contact me to customize your template, or create a new unique one.   Do I need to put a comma between the new and unique adjectives in this sentence?  In my native language (if I am not mistaken) we don't put a comma if the adjectives are of a different type. Not sure about English though, and if it's the case here anyway. Any help would be appreciated! Let $A,B \in \mathbb{M}_n (\mathbb{C})$. If $A^2B + BA^2 = 2ABA$ then exist $k \in \mathbb{N}$ where $(AB-BA)^k = 0$.  I tried solve with minimal polynomial, but I did not have much effect. Proving if $d_0$ is the smallest positive integer in $S$ then $d_0 = \gcd(a,b)$