After installing pathauto I can access the admin pages, set up patterns. But as soon as I tray to bulk generate or manually generate a single alias (edit node and save it) I get an exception. error.log says the url_alias table is missing (and it is). Am I missing something? Used the module quite a lot in D6/D7 though...

Comments

thommyboy created an issue. See original summary.

thommyboy’s picture

Hm- as url_alias is part of Core (?) I uninstalled the module and added a manual alias. This worked and I now see the url_alias table and after re-installing pathauto it works perfectly now. Maybe the table gets only generated at first use?!

sharique’s picture

The url_alias table is still there, there is something wrong with your installation of module, try uninstall and install module again, this should fix it.
Did you get any error when trying to install module?

thommyboy’s picture

no errors on installation- on a clean D8! I just added some nodes, did NOT use url aliases and then installed pathauto with the given problem.
I got the following errors when USING pathauto (bulk or just checkbox on a single node and trying to save the node)
As said- after deinstalling and manually saving an alias and re-installing everything is fine now

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ABC.url_alias' doesn't exist: SELECT pid FROM {url_alias} WHERE source = :source AND langcode IN (:language, :language_none) ORDER BY langcode DESC, pid DESC LIMIT 0, 1; Array ( [:source] => /node/5 [:language] => de [:language_none] => und ) in Drupal\pathauto\AliasStorageHelper->loadBySource() (Zeile 163

berdir’s picture

Yes, core moved that so it's now auto-created. Which is a problem as we're doing queries against it.

Not sure yet what to do. #2672150: Use alias manager and storage services instead of custom queries against url_alias for a start, and if we still have queries then, we could auto-create it too.

dave reid’s picture

Yes, core moved that so it's now auto-created.

What?? This behavior sounds insane. We should trigger the table creation whenever Pathauto is installed. How do we trigger that?

berdir’s picture

I guess we can do that as a workaround at least yes.

The table is part of the service now, we do that for a few tables that are meant to be completely abstracted by a service. The service auto-creates it when accessed (with some tricks, catches exception, checks table and then re-tries).

Which for some makes sense, as a service replacement then doesn't have to create the table.

However, the implementation here seems weird. It will only create the table on save, that means every request will throw and catch an exception but not create the table until you actually create an alias. That has to be a performance problem?

alexpott’s picture

I've created #2704821: url_alias table should be created by system install to create the url_alias storage again on system install. However as @Berdir said in IRC

what pathauto is doing at the moment, especially in bulk update where it joins between entity and the url alias table is something that's not allowed/supported anyway. I'm just waiting for the first bug report from someone who uses mongodb or so for entity storage ;)

I think we need to add some hook_requirements to pathauto to check that both the alias storage and entity storage are using core's defaults.

dave reid’s picture

This should be resolved in the meantime with #2705937: Ensure the url_alias table is created when the module is installed for anyone using an affected version of Drupal core with this bug.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.