Meta
dbfiddle add tag
Jack Douglas
Please post concrete feature requests and bug reports for db<>fiddle here on databases.ta:

1. Join TopAnswers if you aren't already (sign up is one-click and PII free)
1. Click 'Ask' in the header next to your profile picture
1. Choose 'Meta Question' from the question type dropdown
1. Submit your question
1. Add the 'dbfiddle' tag

Please also feel free to comment in the chat room attached to this post.

---

The current list of supported databases is:

* SQL Server 2012, 2014, 2016, 2017, 2017 Linux, 2019 and 2019 Linux RC1
* Postgres 8.4, 9.4, 9.5, 9.6, 10, 11, 12 and 13 (beta)
* Oracle 11.2 and 18
* MySQL 5.6, 5.7 and 8.0
* MariaDB 10.2, 10.3 and 10.4
* SQLite 3.8, 3.16 and 3.27 (but 3.16 is currently offline for [security reasons](https://security-tracker.debian.org/tracker/CVE-2018-20346))
* Db2 Developer-C 11.1 (with lots of thanks to [@mustaccio](https://dba.meta.stackexchange.com/users/23721/mustaccio))
* Firebird 3.0

Here's an example (the image links to the fiddle):

[![SQL Server 2019 'help'](/image?hash=407870c3b82d22484cb884d64c05e7a70ca3f3e97cd776b4f82cf701a55e56a3)
](https://dbfiddle.uk/?rdbms=sqlserver_2019&fiddle=9bcd60e2bcd7966fc3be475addab8eb2)

[db<>fiddle](https://dbfiddle.uk) was designed with markdown-based Q&A in mind, and fiddles can be embedded in posts and comments on TopAnswers. You can edit fiddles and run them live right here:

<>https://dbfiddle.uk/?rdbms=postgres_11&fiddle=71940aadda50f55bfede87606cd1dc2c

That's one from:

@@@ question 1017



Top Answer
Solomon Rutzky
I have several links to db&lt;&gt;fiddle for demos in the following post:

[Unicode Escape Sequences Across Various Languages and Platforms (including Supplementary Characters)](https://sqlquantumleap.com/2019/06/26/unicode-escape-sequences-across-various-languages-and-platforms-including-supplementary-characters/)

So, I got to thinkin: at some point in the future, certain versions of the currently supporting DBs will no longer be offered. What happens to links in that case, given that the links include the DB version? For example, one of the demos I have is:

<https://dbfiddle.uk/?rdbms=postgres_11&fiddle=0ce292fcacf79dd624ba5bb0d34aceb0>

Someday, PostgreSQL 11 might not be supported by db&lt;&gt;fiddle, and that might happen prior to me going through old blog posts and updating links to more current versions. Will these links fail? Will the links merely default to using the most recent version? Or oldest version?

So I tried it out with a valid version that I believe was supported but isn't anymore (it presently shows as "currently unavailable" in the drop-down):

<https://dbfiddle.uk/?rdbms=postgres_9.4&fiddle=0ce292fcacf79dd624ba5bb0d34aceb0>

and received the following error:

> 23503ERROR: insert or update on table "history" violates foreign key constraint "history_rdbms_code_fkey" DETAIL: Key (rdbms_code, fiddle_hash)=(postgres_9.4, \x0ce292fcacf79dd624ba5bb0d34aceb0) is not present in table "fiddle". CONTEXT: SQL function "loghistory" statement 1

Same error occurs with the following bad values for the `rdbms` parameter:

1. <https://dbfiddle.uk/?rdbms=postgres_13&fiddle=0ce292fcacf79dd624ba5bb0d34aceb0>
1. <https://dbfiddle.uk/?rdbms=postgres_bad&fiddle=0ce292fcacf79dd624ba5bb0d34aceb0>
1. <https://dbfiddle.uk/?rdbms=foxpro&fiddle=0ce292fcacf79dd624ba5bb0d34aceb0>


Can this please be fixed to handle bad `rdbms` values in the following manner:

1. If either a) the RDBMS is unsupported, or b) the version is not a number, display appropriate error message / page.
1. If the RDBMS is supported but the version is less-than the lowest supported version on db&lt;&gt;fiddle, perhaps default to lowest supported version.
1. If the RDBMS is supported but the version is greater-than the highest supported version on db&lt;&gt;fiddle, perhaps default to highest supported version.

This approach allows for using "0" or "1" as the version to always get the lowest supported version, and using "9999" to always get the highest (i.e. most recent) supported version. For a lot of use cases, the specific version is either irrelevant (meaning any supported version would work), or just needs to be "at least version X". In both of those cases, going with "highest supported version" extends the longevity of many links.

&nbsp;

P.S. Awesome project; thanks for creating and providing it &#x1F63A;
Answer #2
PeterVandivier
`feature-request` **Concurrency Support**

Sometimes you want to demo a deadlock. It'd be really neat if you could show people what you were talking about with a fiddle link. 

I'm sure this is a _very significant_ amount of work on the backend, but I want to ask the question :)

[HT Mr Darnell](https://topanswers.xyz/transcript?room=4&id=60763&year=2020&month=7&day=23#c60763)
Answer #3
fiatjaf
The "ff" ligature destroys the cursor position. See GIF below:

![](https://i.imgur.com/rSZS6Y6.gif)
Answer #4
PeterVandivier
`bug` `fixed` Brittle fiddle one-boxing in chat

One-boxing in small fiddles in chat is great. Sadly, it seems that leaving a page and returning causes the one-boxing render to break. 

See [this chat thread][1] for context & repro steps.  

Note that the transcript one-boxing appears to be stable and does not appear to be affected by this behaviour. 

Using...

> Google Chrome Version 79.0.3945.130 (Official Build) (64-bit)

[1]: https://topanswers.xyz/transcript?room=644&id=16493#c16493
[2]: https://topanswers.xyz/transcript?room=37&id=16598#c16598
Answer #5
PeterVandivier
`bug` `fixed` YYYY-MM-DD for SQL Server

![](https://imgs.xkcd.com/comics/iso_8601.png)

It looks like SQL Server is the only non-ISO localisation at the moment, but I've embedded a few of my favourites below for ongoing reference.

<>https://dbfiddle.uk/?rdbms=sqlserver_2019&fiddle=b5aa1e2bb74237fde0de2c5ccb632c98

<>https://dbfiddle.uk/?rdbms=postgres_12&fiddle=a9e479467e8185aaf4e8f6eeff753dbc

<>https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=47edd2b88c652aa72de5e000ae288216

<>https://dbfiddle.uk/?rdbms=sqlite_3.27&fiddle=2f53a982cb229c7959b73bf014848091
Answer #6
PeterVandivier
`bug` `fixed` Embedded fiddles should respect `&hide=` args

---

I'm drafting through https://topanswers.xyz/databases?q=424 and part of my reproduction includes loading ~60,000 rows of data. In the link as written... 

* https://dbfiddle.uk/?rdbms=sqlserver_2017&fiddle=4726813c2d4d6c23fd5d7a50756de4b6&hide=2

...the trailer arg `&hide=2` collapses the batch where I do the load. In the current embed though, the hidden batch is revealed. 

The current fiddle has 5,000 rows (loading the 1k batches from copy-paste is rather taxing on my browser). I'll wait update the fiddle with the remaining rows for the time being 🙂
Answer #7
Ami
`bug` clicking 'Back' should switch back not only the query, but also the database selection.

---

Using Windows 10.0.17763 and Google Chrome 79.0.3495.

Steps to reproduce:
-------------------
Browse to dbfiddle.uk, change query to 'SELECT 1' and click 'run'.
Default engine is SQL Server 2019 and the URL reflects this correctly: https://dbfiddle.uk/***?rdbms=sqlserver_2019***&fiddle=<something>

Change database selection to PostgreSQL 12 (or any other), change query to 'SELECT 2' and click 'run'.
URL now reflects correct engine https://dbfiddle.uk/***?rdbms=postgres_12***&fiddle=<something>

Click browser 'Back' button.
query is correctly reverted to 'SELECT 1' and previous result is shown. URL shows https://dbfiddle.uk/***?rdbms=sqlserver_2019***&fiddle=<something>

However, menu selection remains in 'Postgres 12', and clicking 'Run' again changes the URL back to 'Postgres 12'.

Expected result:
----------------
page should respect URL specification and clicking 'Back' should switch back not only the query, but also the database selection.
Answer #8
PeterVandivier
`feature-request` please add an (opt-in) cookie to remember the last platform a user was on?

# User cookies

When I was a SQL Server Man™️ I appreciated that db<>fiddle launches by default to a recent SQL Server `@@version`.

Now that I'm mainly a PostgreSQL Comrade, I kind of wish it would launch to PostgreSQL. 

Does it make sense to add an (opt-in) tracking cookie to remember the last platform a user was on? Perhaps even integrating with an topanswers profile if available?

This seems like it could be early-stages groundwork for tracking your own specific fiddle history as well, though; so I suppose it could a mixed bag as to how you feel about that as a concept (whether it's a feature or an imposition).
Answer #9
PeterVandivier
`bug` All-null rows collapsing in embedded fiddles

In the following fiddle, rows that contain only null values are collapsed in an unfriendly way 

<>https://dbfiddle.uk/?rdbms=sqlserver_2019&fiddle=4f964e57bb433e06f0bdcc41992605af
Answer #10
PeterVandivier
`feature-request` please add CockroachDB

---

## CockroachDB integration

The [19.2 release][2] makes it look like integrating CockroachDB to db<>fiddle might be relatively easy. Would you be interested in adding CockroachDB as a supported platform?

The [`cockroach demo`][1] command ostensibly provides an ephemeral in-memory enterprise instance; and having seen it in action it appears to do what it says on the tin :)

[1]: https://www.cockroachlabs.com/docs/dev/cockroach-demo.html
[2]: https://www.cockroachlabs.com/blog/cockroachdb-19dot2-release/
---

> **Update Nov 21 '19** - CockroachDB licensing reps have confirmed privately that db<>fiddle is within the acceptable usage of `demo`. Docs have been sent to @Jack for records keeping.

---

~Consolidated~ ~from~ [~here~][3] ~for~ ~tracking.~
 
[3]: https://dba.meta.stackexchange.com/a/3285/68127
Answer #11
PeterVandivier
`feature-request` `declined` add an 'Update this post' button on embedded db<>fiddles on TopAnswers

---

Currently it looks like editing and/or running the fiddle from the embed doesn't change the post. This is obviously good design, but I suggest adding an `Update this post` button or something similar alongside the embedding. This would make it clear to the user that the underlying post may need to be modified if they want it to persist the changes they have just typed 

Some related thoughts:

* Button could hotlink to the `/edit` analogue with the commit message pre-populated à la "_updated fiddle from `abc` to `def`_"
* Perhaps the button only appears on-edit or on-run when a new fiddle hash is generated?
* Does it make sense to track a fiddle's "lineage" & possibly expose it to users to "_go back to that one edit I forgot what I did on but I know what the results looked like_"
* Is there a not-gross way to expose the diff of either the post batch or the last-run batch to the active editor in the embed?
Answer #12
Arioch
`bug` `fixed`: Firebird, datatypes, aligning

https://dbfiddle.uk/?rdbms=firebird_3.0&fiddle=c80635f28efd64914a70160a0cc46ecf

Check last query, and it is especially visible in MarkDown export.

Columns 3 to 5 are left-aligned, despite being numeric.

I suspect the type BigInt or what they are is mis-detected for textual one.
Answer #13
PeterVandivier
`feature-request` sa/postgres/root - superuser fiddles

---

In Q 1214, I demo a fiddle that requires superuser permissions to really see what you want. Sadly but appropriately, db<>fiddle doesn't _just let you have superuser_ permissions.

@@@ question 1214

While it might be very much a long-term goal, it might be useful for a certain small subset of fiddles & platforms to be allow-listed for execution at a higher permission set. 

Perhaps these fiddles could be "manually cached" and tagged to prevent a re-run from overwriting the resultset with a low-permission run.

Certainly this seems like a lot of work; but as always, I want to ask the question :-) 
Answer #14
John aka hot2use
`feature-request` `retracted` Add support for SQL Server `GO [count]` syntax

---

# Support for SQL Server `GO [count]` syntax

In SQL Server you can add the batch operator [`GO`](https://docs.microsoft.com/en-us/sql/t-sql/language-elements/sql-server-utilities-statements-go?view=sql-server-ver15) to the end of either a single or a bunch of commands like this:

    SELECT 1
    GO
    
Or even like this:

    INSERT INTO [TableName] (SomeText, SomeInt)
    VALUES ('false', 1)
    GO
    
If I want to really insert a bunch of items into a table I can tell `GO` to do this multiple times like this:

    INSERT INTO [TableName] (SomeText, SomeInt)
    VALUES ('false', 1)
    GO 633
    
...and the query "batch" will be executed 633 times. 

This is helpful when inserting a fixed amount of pseudo data into a table to reproduce issues in a development environment (and would be helpful in db<>fiddle).

_Sadly I can't add a db<>fiddle to show you how it should work ;-)_

I think the `GO` utility statement has been discussed before, but I don't think the additional `count` was part of the discussion.


### Reference Material

[SQL Server Utilities Statements - GO](https://docs.microsoft.com/en-us/sql/t-sql/language-elements/sql-server-utilities-statements-go?view=sql-server-ver15) (Microsoft | SQL Docs)
Answer #15
Arioch
`feature-request` [`declined`](https://topanswers.xyz/transcript?room=37&id=17302#c17302) Allow multiple statements per batch for Firebird again

---

Firebird, DDL, multiple statements

As far as I remember, this used to work, but no more.

Perhaps parser fails to split script into distinct SQL statements.

https://dbfiddle.uk/?rdbms=firebird_3.0&fiddle=300756710cf77de8d754f04bbcfa07de

```
create table KPS1 ( ID integer primary key, DATE_FROM date not null, DATE_TO date not null ); 
create table KPS2 ( ID integer primary key, DATE_FROM date not null, DATE_TO date not null )
```

Dynamic SQL Error SQL error code = -104 Token unknown - line 6, column 1 create

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.