Plotting time datatype

I have two columns with time datatype, from those columns I create a costume column that takes diff of between columns. But, when I tried to plot the result Metabase unable to display it, I supposed because of the datatype. If there is any way to overcome it, I'll be appreciated!

This is the images when I use SQL Editor

This is when I use custom questions tried to plotting the results

I tried to cast timestamp but it raised ERROR: cannot cast type interval to timestamp without time zone

Hi @amethyst
Please post “Diagnostic Info” from Admin > Troubleshooting.
I’m not sure what is being returned, but try posting the response by looking in the browser developer Network-tab, when running the query.

Here you go sir, thank you in advance

{
  "browser-info": {
    "language": "id-ID",
    "platform": "MacIntel",
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "1.8.0_275-b01",
    "java.vendor": "Red Hat, Inc.",
    "java.vendor.url": "https://www.redhat.com/",
    "java.version": "1.8.0_275",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "25.275-b01",
    "os.name": "Linux",
    "os.version": "4.18.0-240.1.1.el8_3.x86_64",
    "user.language": "en",
    "user.timezone": "Asia/Jakarta"
  },
  "metabase-info": {
    "databases": [
      "postgres",
      "mysql",
      "h2"
    ],
    "hosting-env": "unknown",
    "application-database": "postgres",
    "application-database-details": {
      "database": {
        "name": "PostgreSQL",
        "version": "10.15"
      },
      "jdbc-driver": {
        "name": "PostgreSQL JDBC Driver",
        "version": "42.2.8"
      }
    },
    "run-mode": "prod",
    "version": {
      "tag": "v0.37.5",
      "date": "2021-01-05",
      "branch": "release-x.37.x",
      "hash": "be537ee"
    },
    "settings": {
      "report-timezone": null
    }
  }
}

Actually my question is quite simple “Can I plot the interval time data type that I got from some costum column end_time - start_time? I’m unable to plot it (see my images above on question)”

@amethyst You would need to return an integer instead of interval, which you can do like this:
EXTRACT(epoch FROM "end_time"-"start_time")
But that’s only possible in SQL - there’s an issue open about adding interval support in Metabase:
https://github.com/metabase/metabase/issues/2656 - upvote by clicking :+1: on the first post

1 Like

Thank you!