@a-mckinley, Remo answered to this issue here:
Let me know how it went.
thanks @laurenceisla , issue sorted. My issue was caused by bad interpolation of the PGRST_DB_URI env variable in my docker-compose.yml. Thanks for your help
I'm making solid progress on the db api. PostgREST is truly well designed.
I bumped into something: I'm able to list out the
users using the api schema. However, for some reason I can't seem to repeat the success for the
projects endpoint of the api.
The api code:
CREATE VIEW api.projects as select id, owner_id, redux_config from tnc_db.projects; -- webuser access GRANT select, insert, update(owner_id, redux_config), delete on api.projects to webuser;
As mentioned, using the same strategy for
users I'm able to hit the endpoint and get what is expected... not so for the
It seems that the
api view is not accessing the underlying
tnc_db version of the table.
psql as the superuser:
select id, owner_id, redux_config from tnc_db.projects; > ... > (4 rows) # but not so in the `api.projects`, a view select id, owner_id, redux_config from api.projects; > (0 rows)
Any ideas as to what might prevent the
api wrapper from pulling the records from the source table given?
PS: It's does not seems to be an access/role issue; supported by the problem despite the user of a superuser role. I get the same
(0 rows) response using the
What is the difference between granting
references to a role, vs creating a policy on a table for
GRANT references, select(id, email, active) on table db.users to auth; -- versus CREATE policy webuser_read_users on db.users for select
The policy allows for row-level security; that seems unique to what a policy can do.
referencesgrant more than a read/select?
I'm getting closer. I have the views up and running. Now I'm working on the login capacity.
For some reason, whilst swagger is able to see the endpoint specified using a function, it returns the following error:
TypeError: NetworkError when attempting to fetch resource.
Postman returns message:
"relation \"api.login\" does not exist"
Anyone have this happen?
users.idas a foreign key (so alter table permissions add constraint...)
I seem to recall reading somewhere this could be a problem... and might explain what I'm observing with the following endpoint:
that returns "could not find a relationship between users and user_permissions in the schema cache".
Hi - playing around with this project this evening. Very cool! I went through the tutorial the other day but am wondering how you all usually track db changes in code / version control? (the tutorial suggests running sql directly against the db)
@buckmaxwell I started to use sqitch and I am very happy with it.
Hi. I'm on an M1 macbook. I tried following the instructions here: https://postgrest.org/en/v8.0/install.html#containerized-postgrest-and-db-with-docker-compose
But the output of this is not promising.
db_1 | 2021-09-11 18:52:04.151 UTC  LOG: listening on IPv4 address "0.0.0.0", port 5432 db_1 | 2021-09-11 18:52:04.151 UTC  LOG: listening on IPv6 address "::", port 5432 db_1 | 2021-09-11 18:52:04.153 UTC  LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" db_1 | 2021-09-11 18:52:04.159 UTC  LOG: database system was shut down at 2021-09-11 18:52:01 UTC db_1 | 2021-09-11 18:52:04.162 UTC  LOG: database system is ready to accept connections swagger_1 | 2021/09/11 18:52:05 [emerg] 71#71: io_setup() failed (38: Function not implemented)
docker exec -it postgrest-tutorial_db_1 psql -U app_user app_db, and yeah I know this command is affected by the parent directory of the docker-compose.yml file.
LOAD 'age';to be executed first in every session. Any way to achieve that?