Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-7082

PostgreSQL user default schema does not work

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • Low
    • None
    • 3.3.0, 3.6.1
    • None
    • None

    Description

      According to this documentation: https://confluence.atlassian.com/display/STASH/Connecting+Stash+to+PostgreSQL

      PostgreSQL has the idea of schemas. When you create a PostgreSQL database, a 'public' schema is created and set as the default for that database. It is possible to create a different schema (e.g. 'stash') and set that as the default schema. Stash will use whatever schema is set as the default for the logged-in user. Stash does not provide a way for a user to nominate the schema to use; it uses schema that is set as the PostgreSQL default.

      However, it will only work partially and Stash still trying to use other schema

      Steps to reproduce

      1. Run the following SQL queries:
        CREATE DATABASE atlassian WITH ENCODING='UTF8';
        CREATE USER conf WITH PASSWORD 'conf';
        CREATE SCHEMA AUTHORIZATION conf;
        
      2. Connect a Confluence server to the database "atlassian" with user "conf"
        It will use the schema "conf"
      3. Run the following SQL queries:
        CREATE USER stash WITH PASSWORD 'stash';
        CREATE SCHEMA AUTHORIZATION stash;
        
      4. Connect a Stash server to the database "atlassian" with user "stash"
        The migration function in Stash will failed with the following error:
        2015-02-13 16:47:12,415 ERROR [http-nio-7990-exec-4] kahloun.foong @1050IV3x1007x82x0 kyk9e1 0:0:0:0:0:0:0:1 "POST /admin/db/edit HTTP/1.1" c.a.s.i.db.DefaultDatabaseManager Failed to obtain session factory
        org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryPrototype' defined in class path resource [stash-context.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Missing column: is_allow_all in confgtt.cwd_app_dir_mapping
        	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553) ~[AbstractAutowireCapableBeanFactory.class:4.0.6.RELEASE]
        	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:991) ~[AbstractApplicationContext.class:4.0.6.RELEASE]
        	at com.atlassian.stash.internal.db.DefaultDatabaseManager.createSessionFactory(DefaultDatabaseManager.java:340) [DefaultDatabaseManager.class:na]
        	at com.atlassian.stash.internal.db.DefaultDatabaseManager.prepareDatabase(DefaultDatabaseManager.java:165) [DefaultDatabaseManager.class:na]
        ...
        Caused by: org.hibernate.HibernateException: Missing column: is_allow_all in conf.cwd_app_dir_mapping
        

      Checking the table in the schema "stash", the tables are created correctly. However, Stash is trying to access schema "conf" and the AO tables are missing too.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              klfoong Foong (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: