In the newMips database, the 2 tables user and *_e_user have (almost) the same data. Why? What is the role of each tables?
I guess the answer will help me to understand why the tables role and *_e_role contain different data.
Table user is to manage users of the generator itself.
Table *_e_user is to manage users of generated applications.
Related
I am new to Postgres and want to know if there is a way to CREATE a DB USER in such a way that it will have access to ALL the SCHEMA's including those which are not created yet, I mean access to all the current and future schema's.I have multiple Schema's in my Postgres DB which have the same Tables.If the above is possible I want this user to have SELECT,INSERT,UPDATE on only 2 Tables in the existing and future created Schemas.
You can use ALTER DEFAULT PRIVILEGES to give a user permissions on future schemas and tables, but you cannot restrict that to certain table names.
You may be able to do that with an event trigger.
Personally, I would put GRANT statements into the code that creates the tables.
I'm new to this but I just installed Oracle Database 19c and SQL Developer. I am successfully connected to the HR sample schema. I can query against the HR tables such as HR.EMPLOYEES, etc.. However, in the Connections pane, when I expand the tables under this connection, there is a long list of tables starting with AQ$_INTERNET_AGENTS_PRIVS and a big list of other tables, but I can't see any of the HR tables? Where are they? Is this a view setting maybe?
This is for practice/homework. While it still seems to work, I can't figure out what the problem is. Researched here and other locations on the web.
The UI shows you the tables (and other objects) that belong to the schema for the user you have logged into.
So if you login in as HR, you'll see the tables for HR.
Otherwise if you want to see objects belonging to a different schema, navigate to the 'Other Users' node.
Or if you have synonyms in your schema which point to tables in another schema, you can ask SQL Developer to display those
And now when I look at my Tables list for my user that doesn't have any tables..
I talk about this in a bit more detail here.
JPA Tools -> Generate Entities from Tables... results in duplicate fields:
Predictably this results in this:
Not shown are all the duplicated getters and setters. Deleting them is a pain, even for a small class like this.
I cannot see any easy option to fix this. Does anyone have any ideas why it's happening? Thanks in advance.
This is true for mysql. I had three identical schemas with the same user table on mysql database instance. The entity created by the JPA Tools plugin had multiple fields with same name mapped to the multiple user tables in various schemas. Once I deleted all but one schema on the database, the tool retrieved correct list of fields that mapped to columns on the table
I had the same issue. I just renamed the other table in another schema. It seems that the Generate Entities from Table in Eclipse for a MySQL database looks for all tables with the same name no matter the schema.
I am initiating a new project which will be available as a SaaS for multiple customers. So, I am thinking of creating a database and then create individual schema for every customer.
I have defined some rules and the first rule is all the customers must always have the same schema. No matter what. If one customer gets an update, all the other customers will get the update as well.
For this purpose, my question is, is it possible to inherit schema from another schema in the same database? If not, do I have to manually create all the tables and indexes in the new schema and inherit them from the tables in master schema?
I am using Postgresql 9.6 but I can upgrade it as well if needed.
I open to suggestions.
Thanks in advance
There is no automated way to establish inheritance between all tables in two schemas, you'd have to do it one by one (a function can help).
However, I invite you to stop and think about your data model for a bit. How many users do you expect? If there could be many, plan differently, because databases with thousands of schemas become unwieldy (e.g. catalog lookups will become slow).
You might be better off with one schema for all users. If you are concerned with separation of the data and security, row level security might be the solution for you.
I am wondering if anyone knows a command to create a read-only user for all schemas and tables in a postgres DB. I have found ways to do it for specific tables and specific schemas but not across the board (we have many schemas and I would rather not run the command 60+ times). Thanks in advance
There is no simple way to do that in PostgreSQL.
What you should do is create a role that has read access to all tables (and yes, you'll have to run at least one GRANT statement per schema) and grant that role to all login users that need read access.
That way you have to do the work only once, and dropping the user becomes so much easier.