Then each time I run that, I simply change and help would be appreciated. Select * from SHAREDSCHEMA.sometable where MYCOL = $$ Views in Postgresql can't have primary keys. I know this isn't valid code, but essentially this is what I am trying to do: do $$ Firstly, we will open the psql in our local. The syntax of Create view command is as follows. I could probably write some Python script or something to generate the code but I'd rather do it in Postgres if possible. To create a PostgreSQL view, we use the CREATE VIEW command. Again, the only difference between each iteration is the schema name changes and the where clause changes. So what I need to do is create that view around 200 times with each iteration being: SCHEMA1.myview By the way, you may consult our blog post to learn more about creating a new PostgreSQL database using dbForge Studio. Afterward, simply click Execute, and your view will be created. On the toolbar, click New SQL and enter the required CREATE VIEW query in the SQL window. Select * from SHAREDSCHEMA.sometable where MYCOL = 'ABC' Creating a PostgreSQL view is a matter of moments. One of them is that the information about a view in the. I have about 200 views to create and the only difference in each one of them is the schema location and the where clause.įor example: create or replace view SCHEMA1.myview as because this is exactly what the CREATE VIEW command does internally. I know how to do this in MySQL and MSSQL but I'm struggling to do the same in Postgres 10.12.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |