MyBB Community Forums

Full Version: duplicate key value violates unique constraint - Postgres
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, it looks like plugins that use PluginLibrary's templates method are breaking in the latest version of MyBB. To test this, I freshly installed one such plugin, Symposium, which gave me the following error upon installation.

I am using the following:

MyBB Version: 1.8.33
PHP Version: 7.4.33
SQL Engine: PostgreSQL (PDO) 14.8

I created it using the official Docker Compose file (https://github.com/mybb/docker).

<error>
	<dateline>1683944216</dateline>
	<script></script>
	<line>0</line>
	<type>20</type>
	<friendly_type>MyBB SQL Error</friendly_type>
	<message>SQL Error: 23505 - ERROR:  duplicate key value violates unique constraint "mybb_templategroups_pkey"
DETAIL:  Key (gid)=(3) already exists.
Query: INSERT
			INTO mybb_templategroups (prefix,title)
			VALUES ('symposium','Symposium')</message>
	<back_trace>#0  errorHandler->error() called at [/inc/AbstractPdoDbDriver.php:388]
#1  AbstractPdoDbDriver->error() called at [/inc/AbstractPdoDbDriver.php:467]
#2  AbstractPdoDbDriver->query() called at [/inc/db_pgsql_pdo.php:52]
#3  PostgresPdoDbDriver->query() called at [/inc/AbstractPdoDbDriver.php:500]
#4  AbstractPdoDbDriver->write_query() called at [/inc/db_pgsql_pdo.php:193]
#5  PostgresPdoDbDriver->insert_query() called at [/inc/plugins/pluginlibrary.php:273]
#6  PluginLibrary->templates() called at [/inc/plugins/symposium.php:211]
#7  symposium_install() called at [/admin/modules/config/plugins.php:432]
#8  require() called at [/admin/index.php:830]
</back_trace>
</error>