Create table command setting Default value for column not working

28 views
Skip to first unread message

Kiran Padiyar

unread,
Dec 22, 2019, 5:47:30 PM12/22/19
to Google Cloud SQL discuss
Hi, 
We have set of tables developed earlier in onprem MySQL database. Now we are moving to Google SQL for production run. 
For example a sample table creation like follows onprem MySQL works perfect.
create table myschema.test (
valt int auto_increment primary key,
valkey varchar(50) default (replace(uuid(),''-'','''')),
valtree varchar(30)
)

However, when we connect to Google SQL instance and try to create same table, it shows error at the default. If we remove default for the column it works all ok.
Any idea how to fix this?

Thank you
Kiran

Matt Turner

unread,
Dec 22, 2019, 11:19:37 PM12/22/19
to google-cloud...@googlegroups.com
Kiran,

Do you know which part of the default is causing the error? Have you tried simplifying as a test? Also check the quotes you sometimes get conversions on copy and paste. 

Regards,

Matt

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/ded64fbc-e642-41b9-ad10-166a08a7a9ea%40googlegroups.com.
--


  
Matt Turner | mat...@google.com
  Cloud Customer Engineer
  +61 (0) 447 533 754
  
Perth, Western Australia
The Sustainable Cloud

kiran....@zenspectra.com

unread,
Dec 22, 2019, 11:30:05 PM12/22/19
to google-cloud...@googlegroups.com
Hi Matt,
I figured this out. As Google cloud SQL is still on MySQL 5.7 , it is not supporting function use in default. My local MySQL was 8x so it was working there. To overcome this issue, i had to pass UUID from node.js app itself than depending on MySQL.

Thanks a lot
Kiran


Reply all
Reply to author
Forward
0 new messages