Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

[HELP] : Failed to execute query: 'ALTER TABLE glinks_Category CHANGE

Quote Reply
[HELP] : Failed to execute query: 'ALTER TABLE glinks_Category CHANGE
Hello,

I thought I was doing this right, however perhaps not. Can you please help me with this?

Ideally I am wanting to set 'index' as default condition for category-field-property 'seo-index' , as based on this value, I will dynamically add index and noindex tags in the page header.

However when I try to use ENUM property & set index as default, it is giving me following error:

Failed to execute query: 'ALTER TABLE glinks_Category CHANGE seo_index seo_index ENUM('index','noindex') DEFAULT 'index' NOT NULL': Data truncated for column 'seo_index' at row 1

I have attached screen-shot for reference purposes.

Thanks.

Vishal
-------------------------------------------------------

Last edited by:

VishalT: Jun 30, 2021, 1:32 AM
Quote Reply
Re: [VishalT] [HELP] : Failed to execute query: 'ALTER TABLE glinks_Category CHANGE In reply to
What do you get if you run:

Code:
SELECT MAX(LENGTH(seo_index)) FROM glinks_Category;

and also:

Code:
SELECT DISTINCT(seo_index) FROM glinks_Category;

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: Jun 30, 2021, 10:58 AM
Quote Reply
Re: [Andy] [HELP] : Failed to execute query: 'ALTER TABLE glinks_Category CHANGE In reply to
It returns one row, but nothing in it.

Screenshot attached.

What do you think?

Vishal
-------------------------------------------------------
Quote Reply
Re: [VishalT] [HELP] : Failed to execute query: 'ALTER TABLE glinks_Category CHANGE In reply to
What output from
Code:
EXPLAIN TABLE glinks_Category
do you get?

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] [HELP] : Failed to execute query: 'ALTER TABLE glinks_Category CHANGE In reply to
Andy wrote:
What output from
Code:
EXPLAIN TABLE glinks_Category
do you get?


Error: Could not execute query: Failed to execute query: 'EXPLAIN TABLE glinks_Category': You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'TABLE glinks_Category' at line 1

Vishal
-------------------------------------------------------
Quote Reply
Re: [Andy] [HELP] : Failed to execute query: 'ALTER TABLE glinks_Category CHANGE In reply to
I deleted the field & updated the indexing scheme for Category Properties to INTERNAL.

& Then I re-created the category table seo_index & now it seems to be working.

However, for some reason it does not work when I use values as
index
noindex

but it does work with ENUM values as
Yes
No

Vishal
-------------------------------------------------------
Quote Reply
Re: [VishalT] [HELP] : Failed to execute query: 'ALTER TABLE glinks_Category CHANGE In reply to
There must be some issue with field, as now I just created another test field with ENUM values as

index
noindex

& it is working just fine..

Vishal
-------------------------------------------------------
Quote Reply
Re: [VishalT] [HELP] : Failed to execute query: 'ALTER TABLE glinks_Category CHANGE In reply to
I'm afraid I don't use ENUM's. They are always a PITA to setup from the GLinks admin panel. Much easier to use a CHAR(7) (or whatever you need), then a SELECT box, with values in both "names" and "values" :)

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] [HELP] : Failed to execute query: 'ALTER TABLE glinks_Category CHANGE In reply to
Would it work the same say?

Using this method i.e. can I use the if/else if conditions too? & does it work for search functions too?

Vishal
-------------------------------------------------------
Quote Reply
Re: [VishalT] [HELP] : Failed to execute query: 'ALTER TABLE glinks_Category CHANGE In reply to
Yup SELECT boxes work fine. You can set the exact same values in "form names" and "form values" (in the glinks admin panel). ENUM's supposedly save a tiny bit of disk space, but I've never found it has much of an effect.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] [HELP] : Failed to execute query: 'ALTER TABLE glinks_Category CHANGE In reply to
Andy wrote:
Yup SELECT boxes work fine. You can set the exact same values in "form names" and "form values" (in the glinks admin panel). ENUM's supposedly save a tiny bit of disk space, but I've never found it has much of an effect.

Thanks Andy, this info is awesome.

Would this idea also work with Checkboxes & Multi-Select?

Vishal
-------------------------------------------------------
Quote Reply
Re: [VishalT] [HELP] : Failed to execute query: 'ALTER TABLE glinks_Category CHANGE In reply to
Yup you can do the same with SELECT/CHECKBOX/RADIO

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] [HELP] : Failed to execute query: 'ALTER TABLE glinks_Category CHANGE In reply to
Andy wrote:
Yup you can do the same with SELECT/CHECKBOX/RADIO

Wow.. Thanks Andy.. Smile Smile

Vishal
-------------------------------------------------------