question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create schema of same name when user is created

See original GitHub issue

It common to have a schema that the same name as a user in a database. By default, postgres includes such a schema in its search_path automatically, see “section 5.8.3” in the docs.

It would be ace to have an option in ldap2pg that would create a schema of the same name when a user is newly created.

Thanks

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jeanpommiercommented, Oct 7, 2021

I’m thinking of extending ldap2pg to help managing this case. Here is an idea:

- role:
    name: '{cn}'
    on_create: |
      CREATE SCHEMA {role};
    on_alter: |
      ALTER SCHEMA {old} RENAME TO {new};
    on_drop: |
      DROP SCHEMA {role} CASCADE;

@bersace, is it still considered ? This looks quite interesting. Would definitely be useful for me !

0reactions
alehaacommented, May 30, 2022

Would you prefer global on_create, on_drop ? Thanks for the feedback.

I would like to see both. Some queries might be useful on a global level, others just for specific roles.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CREATE SCHEMA (Transact-SQL) - Microsoft Learn
The created database principal and schema will have the same name as the name that user used when connecting to SQL Server (the...
Read more >
SQL Server CREATE SCHEMA Statement By Examples
SQL Server provides us with some pre-defined schemas which have the same names as the built-in database users and roles, for example: dbo...
Read more >
CREATE SCHEMA statement
The CREATE SCHEMA statement is used to create a schema. A schema name cannot exceed 128 characters. Schema names must be unique within...
Read more >
SQL CREATE/ALTER/DROP SCHEMA - w3resource
Database Schema ; schema_name, The name of a schema to be created. If this is omitted, the user_name is used as the schema...
Read more >
Documentation: 15: CREATE SCHEMA - PostgreSQL
schema_name. The name of a schema to be created. · user_name. The role name of the user who will own the new schema....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found