简体   繁体   中英

Doctrine2/DBAL + Postgresql - public. schema missing in Doctrine queries | Empty query's result

on my VPS server queires Doctrine's query responsible for counting executed migrations returns no rows. Problem is weird, using PHPStorm sometimes I also got no results but it happens only when I skip public . schema. I can't set in Doctrine's config table name with public. prefix due to further DBAL problems. Localy I got same version of PgSQL 9.6 and PHP 5.6, onle difference @VPS is PHP 7.1.

#------------------------------------------------------------------------------
# CLIENT CONNECTION DEFAULTS
#------------------------------------------------------------------------------

# - Statement Behavior -

#search_path = '"$user", public'    # schema names
#default_tablespace = ''        # a tablespace name, '' uses the default
#temp_tablespaces = ''          # a list of tablespace names, '' uses

Changing search_path helps partialy, it sometimes causes rows to appear as query's result however Doctrine migration still has problem with it.

Queries:

SELECT * FROM doctrine_migration_versions;  --  sometimes no results, even if ros actually exists
SELECT * FROM public.doctrine_migration_versions;   --  works always

Thanks in advance for any answears.

I found the problem. Problem was that database user was the same as existing schema. That's why Postgres by default was looking for user named schema and it found it. Changing postgres conf to do not look for user but public. schema only, solved 'problem'

#search_path = '"$user", public'    # schema names 

to

search_path = 'public'    # schema names 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM