yii2接入pgSQL(查詢不到表The table does not exist: {{%user}})
yii2框架接入pgSQL(查詢不到表The table does not exist: {{%user}})
我是yii2的框架做的系統接的是MySQL資料庫,後面因為其他情況又要去接pgSQL,導致遇到上面的情況,我的情況是我的pgSQL資料庫下有賬號的表兩個,我用的是第一個賬號下的表,但系統獲取的是第二個public賬號下的表,導致系統執行要查詢表的時候就會報錯The table does not exist: {{%user}}.
解決辦法:
在yii2專案中的config/db.php中加入以下程式碼
<?php
return [
'class' => 'yii\db\Connection',
'dsn' => 'pgsql:host=192.168.01.01;port=5432;dbname=test',
'username' => 'test',
'password' => '123456',
'tablePrefix' => 'ts_', //表字首
'schemaMap' => [
'pgsql'=> [
'class'=>'yii\db\pgsql\Schema',
'defaultSchema' => 'public' //指定系統接pgSQL資料庫下哪個賬號的表
]
],
];
相關文章
- pgsql查詢優化之模糊查詢SQL優化
- 安裝kernel...src.rpm錯誤:warning: user mockbuild does not exist - using rootMockUI
- [BUG反饋]子查詢報錯,Base table or view not found: 1146 Table 'onethink.(' doesn't existView
- pgsql 執行建庫指令碼時候出現ERROR: relation "xxx_id_seq" does not existSQL指令碼Error
- dcat-admin 表單 Field type [autocomplete] does not exist.
- Waring: /dev/centos/swap does not existdevCentOS
- Property [title] does not exist on this collection instance
- PSQLexception: ERROR : type "signed" does not existSQLExceptionError
- audit by user by table
- Property 'context' does not exist on type 'NodeRequire'.ts(2339)ContextUI
- Laravel Class env does not exist 問題排查Laravel
- ABAP 資料結構啟用時的錯誤訊息 - combination reference table field does not exist資料結構
- MyBatis-maven-User例子-根據id查詢UserMyBatisMaven
- SAP對工單做101收貨,報錯- Check table TFBEFU_CR entry 10 does not exist–對策
- create table 使用select查詢語句建立表的方法分享
- ORA-04043: object DBA_DATA_FILES does not existObject
- [20211231]ORA-01418 specified index does not exist.txtIndex
- SAP MM 對採購訂單執行收貨,報錯 - Table T169P entry ZNMI does not exist -
- yii2 資料庫常見查詢資料庫
- ORA-30012 undo tablespace 'UNDOTBS3' does not exist or of wrong typeS3
- The operation, ‘DecodeJpeg/contents‘, does not exist in the graph.錯誤解決方法
- SQL 查詢 exist join in 的用法和相應的適用場景 (最佳化查詢)SQL
- Yii2:ArrayDataProvider 小改動後支援分頁查詢IDE
- 單表查詢
- Android解決The APK file app-debug.apk does not exist on disk.AndroidAPKAPP
- pgsql 連表更新語法SQL
- 靜默安裝Oracle建庫時報Template General Purpose does not existOracle
- streamlit run執行報錯,Invalid value: File does not exist: XXX.py
- Error: The directory named as part of the path ./log/supervisord.log does not exist解決方案Error
- 查詢 - 符號表符號
- MySQL 單表查詢MySql
- MySQL單表查詢MySql
- JPA 連表查詢
- mysql鎖表查詢MySql
- 資料庫基礎查詢--單表查詢資料庫
- Eclipse裡Tomcat報錯:Document base ……does not exist or is not a readable directory(圖文詳解)...EclipseTomcat
- Hadoop的mapreduce出現問題,報錯The auxService:mapreduce_shuffle does not existHadoopUX
- git中出現”the requested upstream branch ‘origin/master‘ does not exist“問題的解決GitAST