Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-26070

Unknown column in 'field list' when using mysql -e "query..." from bash

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Not a Bug
    • 10.4.19
    • N/A
    • N/A
    • None
    • linux, Fedora32
      bash shell, GNU bash, version 5.0.17(1)-release
      Server version: 10.4.19
      mysql Ver 15.1 Distrib 10.4.19-MariaDB, for Linux (x86_64) using EditLine wrapper

    Description

      From bash:
      mysql --delimiter=',' -p tlogger -e "SELECT DATE(datetime) AS dat, rain - LAG(rain) OVER (ORDER BY dat) AS day_rain from rainfall GROUP BY dat;" > rain.csv
      ERROR 1054 (42S22) at line 1: Unknown column 'datetime' in 'field list'

      However if I am in the interactive mysql shell the query succeeds.

      Table created with:

      CREATE TABLE `rainfall` (
      `datetime` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
      `temper` decimal(6,3) DEFAULT NULL,
      `rain` decimal(10,2) DEFAULT NULL,
      `id` int(11) DEFAULT NULL,
      `battery` int(11) DEFAULT NULL,
      PRIMARY KEY (`datetime`)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

      Attachments

        Activity

          People

            danblack Daniel Black
            saxicola Mike Evans
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.