Mrudhulraj commented on PR #5962:
URL: https://github.com/apache/texera/pull/5962#issuecomment-4827020579

   Let me explain a bit further @carloea2 with schema :
   
   Table "texera_db.dataset_user_access"
   
     Column   |      Type      | Nullable | Default
   -----------+----------------+----------+------------------------
     did      | integer        | not null | 
     uid      | integer        | not null | 
     privilege| privilege_enum | not null | 'NONE'::privilege_enum
   
   Indexes:
     "dataset_user_access_pkey" PRIMARY KEY, btree (did, uid)   
   
   Foreign-key constraints:
       "dataset_user_access_did_fkey" FOREIGN KEY (did) REFERENCES dataset(did) 
ON DELETE CASCADE
       "dataset_user_access_uid_fkey" FOREIGN KEY (uid) REFERENCES "user"(uid) 
ON DELETE CASCADE
   
   Table "texera_db.dataset"
     Column      | Type             | Nullable | Default
   
--------------+------------------+----------+--------------------------------------
     did         | integer          | not null | 
nextval('dataset_did_seq'::regclass)
     owner_uid   | integer          | not null | 
     name        | character varying| not null | 
     is_public   | boolean          | not null | true
    
   Foreign-key constraints:
       "dataset_owner_uid_fkey" FOREIGN KEY (owner_uid) REFERENCES "user"(uid) 
ON DELETE CASCADE
   
   
   What we see is that when `did` `is_public=true` in `dataset`, we have one 
row with the same `did` in `dua` (dataset_user_access) where privilege is 
"NONE".
   
   Also when `did` of the same dataset for one of the uids in dua changes we 
modify the privilege for that `uid`.
   
   After applying joins with `uid` set and `public=true` we result in duplicate 
rows, because we get NONE(with `is_public=true`) from other users and the same 
dataset from the `uid` set which has `WRITE` access now.
   
   PS: 
   1. I am not sure if there would be a need to migrate is_public attribute to 
dua. OR
   2. Accept the modified query I propose.
   
   Hope this clarifies!!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to