[MDEV-11324] got error 'Invalid default value for timestamp column' when trying create copy table structure from view Created: 2016-11-21 Updated: 2016-12-07 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Temporary |
| Fix Version/s: | None |
| Type: | Task | Priority: | Minor |
| Reporter: | Mikhail Gavrilov | Assignee: | Oleksandr Byelkin |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
I create duplicate issue of https://jira.mariadb.org/browse/MDEV-10935 |
| Comments |
| Comment by Elena Stepanova [ 2016-11-21 ] | ||||||
|
There are plenty of ways to do what you are trying to do. To copy a view structure, you don't need a temporary table which selects from the view, you need to use the same SELECT that the view uses – that is, select from the underlying table. If you do need a table to be created by selecting from a view on whatever reason, you can unset 'NO_ZERO_DATE' in sql_mode. If you do need the table to select from a view, and you absolutely need NO_ZERO_DATE at this very moment, you can specify the column definition explicitly, something like
The chosen way is a combination of conditions that simply cannot work together. You select from a view which has no knowledge whasoever about default column values in underlying tables, it can only use the "hard" default; then, you forbid this hard default by setting 'NO_ZERO_DATE'. | ||||||
| Comment by Mikhail Gavrilov [ 2016-11-27 ] | ||||||
|
> The chosen way is a combination of conditions that simply cannot work together. You select from a view which has no knowledge whasoever about default column values in underlying tables, it can only use the "hard" default; then, you forbid this hard default by setting 'NO_ZERO_DATE'. Why DBMS in the SELECT context with lots of JOINs understands default column values, but in VIEW no understands?
I an understand this is nowhere described, but currently really annoying. Because error message senseless and expected that SELECT always can replaceble by VIEW. It cannot be fixed by design? | ||||||
| Comment by Elena Stepanova [ 2016-12-07 ] | ||||||
|
I've converted it into a feature request, if you want to make it such, but it cannot possibly be critical, because there are many ways to accomplish this goal, you're just choosing one which cannot work with current implementation. |