Answer the question
In order to leave comments, you need to log in
How to write a query in PostgreSql?
Colleagues, good day to all. I ask for help IMHO there is not enough or already confused))) The essence is this:
There is a products table, each product has an owner. There are also roles - admin, owner and guest. product model:
{
userId, // owner продукта
categoryId,
title,
slug,
avatar,
approved,
published,
publishedAt,
createdAt,
}
Answer the question
In order to leave comments, you need to log in
A clumsy version on the forehead, make UNION
all three requests from different rights, where instead of inaccessible fields you insert at least NULL
, at least в доступе отказано
.
A more beautiful option, you have three views ala ViewProductByAdmin
, which, if there are not enough rights, returns a cookie, and the choice of the view already lies with the client.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question