Skip to content

Conversation

richard67
Copy link
Member

@richard67 richard67 commented Oct 7, 2025

Pull Request for Issue # .

Summary of Changes

This pull request (PR) removes the wrong unique constraint for the "core_type_alias" and "core_content_item_id" column combination from the "#__ucm_content" table for PostgreSQL databases.

For MySQL we do not have that constraint, see https://github.com/joomla/joomla-cms/blob/5.3-dev/installation/sql/mysql/supports.sql#L305-L350 .

It is an old bug we have at least since Joomla 3.2.7. That was the oldest package I had here to check where the constraint exists for PostgreSQL but not for MySQL.

Because 5.3-dev is close to end of life, I make this PR for 5.4-dev.

As it's not a release blocker it comes too late for 5.4.0, but will then hopefully go into 5.4.1.

See also PR #46269 for 6.0-dev for the same bug.

Testing Instructions

Important: It needs a PostgreSQL database to reproduce the issue and test the fix.

Have content history enabled and some articles which have multiple tags assigned.

You can achieve this my making a new installation and then installing blog sample data.

Then edit an article which has some tags assigned, e.g. in case of blog sample data the "Your Template" or any other in the "Blog" category.

Change the content of the article and remove some assigned tag and then use the "Save" button.

Check the edit page after it has reloaded.

Actual result BEFORE applying this Pull Request

With a MySQL or MariaDB database, all works. The content changes are shown, and the previously unassigned tag is not shown anymore.

With a PostgreSQL database, the reloaded page shows the previously unassigned tag again. Content changes are shown.

In the error log of the PostgreSQL server you will find:

ERROR:  duplicate key value violates unique constraint "j3ux0_ucm_content_idx_type_alias_item_id"
DETAIL:  Key (core_type_alias, core_content_item_id)=(com_content.article, 6) already exists.
STATEMENT:  INSERT INTO "j3ux0_ucm_content"
	("core_type_alias","core_title","core_alias","core_body","core_state","core_access","core_params","core_featured","core_metadata","core_created_user_id","core_created_by_alias","core_created_time","core_modified_user_id","core_modified_time","core_language","core_publish_up","core_content_item_id","asset_id","core_images","core_urls","core_hits","core_version","core_ordering","core_metakey","core_metadesc","core_catid","core_type_id") VALUES 
	('com_content.article','Your Template','your-template','<p>Templates control the look and feel of your website.</p>\r\n<p>This blog is installed with the Cassiopeia template.</p>\r\n<p>You can edit the options by selecting the Working on Your Site, Template Settings link in the menu which is visible when you log in.</p>\r\n<p>For example you can change the site background colour, highlights colour, site title, site description and title font used.</p>\r\n<p>More options are available in the site administrator. You may also install a new template using the extension manager.</p>\r\n<p>Blablabl.</p>',1,1,'{"article_layout":"","show_title":"","link_titles":"","show_tags":"","show_intro":"","info_block_position":"","info_block_show_title":"","show_category":"","link_category":"","show_parent_category":"","link_parent_category":"","show_author":"","link_author":"","show_create_date":"","show_modify_date":"","show_publish_date":"","show_item_navigation":"","show_hits":"","show_noauth":"","urls_position":"","alternative_readmore":"","article_page_title":"","show_publishing_options":"","show_article_options":"","show_urls_images_backend":"","show_urls_images_frontend":""}',1,'{"robots":"","author":"","rights":""}',368,'Joomla','2025-10-07 07:57:32',368,'2025-10-07 08:28:15','*','2025-10-07 07:57:32',6,133,'{"image_intro":"images\\/sampledata\\/cassiopeia\\/nasa4-1200.jpg#joomlaImage:\\/\\/local-images\\/sampledata\\/cassiopeia\\/nasa4-1200.jpg?width=1200&height=400","image_intro_alt":"","image_intro_alt_empty":"1","float_intro":"","image_intro_caption":"","image_fulltext":"images\\/sampledata\\/cassiopeia\\/nasa4-400.jpg#joomlaImage:\\/\\/local-images\\/sampledata\\/cassiopeia\\/nasa4-400.jpg?width=400&height=400","image_fulltext_alt":"","image_fulltext_alt_empty":"1","float_fulltext":"float-start","image_fulltext_caption":"www.nasa.gov\\/multimedia\\/imagegallery"}','{"urla":"","urlatext":"","targeta":"","urlb":"","urlbtext":"","targetb":"","urlc":"","urlctext":"","targetc":""}',0,10,0,'','',8,1)
	RETURNING core_content_id

Expected result AFTER applying this Pull Request

With a PostgreSQL database it works as well as with MySQL or MariaDB, the content changes are shown, and the previously unassigned tag is not shown anymore.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@brianteeman
Copy link
Contributor

I have tested this item ✅ successfully on 5439f5b

tested in j5 and 6


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46243.

@richard67
Copy link
Member Author

@brianteeman You have PostgreSQL? I didn't know that.

@brianteeman
Copy link
Contributor

@brianteeman You have PostgreSQL? I didn't know that.

yes - ofc - currently only 14.5 - need to update

@alikon
Copy link
Contributor

alikon commented Oct 11, 2025

I have tested this item ✅ successfully on 5439f5b

on postgresql 15.14


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46243.

@alikon
Copy link
Contributor

alikon commented Oct 11, 2025

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46243.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Oct 11, 2025
@richard67 richard67 added this to the Joomla! 5.4.1 milestone Oct 11, 2025
@muhme
Copy link
Contributor

muhme commented Oct 15, 2025

✅ Final test before merging with JBT using pgsql

  • Tested before: Reloaded page shows the previously unassigned tags again and docker log jbt-pg shows duplicate key value
  • Grafted PRs full package with pgsql: Unassigned tags remain unassigned, new tags can be added, article content change is saved and no more duplicate key value errors

@muhme muhme merged commit 166fb1c into joomla:5.4-dev Oct 15, 2025
40 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Oct 15, 2025
@muhme
Copy link
Contributor

muhme commented Oct 15, 2025

Thank you @richard67 for your contribution. Thank you @brianteeman and @alikon for testing.

@richard67 richard67 deleted the 5.4-dev-fix-ucm-content-postgresql branch October 15, 2025 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants