77

Update Jan 2020:

Please note, the place for reporting db<>fiddle bugs and feature requests is now on this TopAnswers post pending a future move to a GitHub issue tracker!.


SQLFiddle has been an essential tool and a great complement to dba.se for a very long time, but it has gone downhill a bit in the last year or two.

I have also wondered for some time what a 'fiddle' designed specifically with dba.se and markdown in mind might look like, and over the last few days I've put together a prototype of how I think it should be.

Please have a play with the site and let me know here if you have suggestions for improvements or design changes.

The current list of supported databases is:

  • Db2 Developer-C 11.1 (with lots of thanks to @mustaccio)
  • Firebird 3.0
  • MariaDB 10.2, 10.3 and 10.4
  • MySQL 5.6, 5.7 and 8.0
  • Oracle 11.2 and 18
  • Postgres 8.4, 9.4, 9.5, 9.6, 10, 11 and 12
  • SQL Server 2012, 2014, 2016, 2017, 2017 Linux and 2019 Linux RC1
  • SQLite 3.8, 3.16 and 3.27 (but 3.16 is currently offline for security reasons)

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

  • enter image description here

I've edited some of my answers (e.g. this one) to use db<>fiddle.

As of Apr 2018 the site uses ssl by default — there are some benefits even for a site like db<>fiddle and it's free now so why not?

As of Apr 2019 you can now hide batches selectively.

50
  • 14
    +1, +10, +1000000000000000000 Commented Feb 16, 2017 at 18:28
  • 7
    ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
    – MDCCL
    Commented Feb 16, 2017 at 21:14
  • 3
    +2 also. It would be a welcome addition. As wishes are cheap: having several versions (i.e.: PostgreSQL 9.4, 9.5, 9.6...) of the same DB would be a plus. Sometimes you don't know when your problem is just version specific... and you'd better upgrate quickly.
    – joanolo
    Commented Feb 19, 2017 at 6:38
  • 3
    @joanolo "As wishes are cheap" not at all, thanks for the suggestion. I've added 9.5 and 9.4, and will add others at some point! Commented Feb 19, 2017 at 18:16
  • 4
    As sqlfiddle is an established site, and you seem to have already invested time and effort in to it according to the about page, couldn't SE just adopt it and make sql fiddle great again, by pushing some resources towards it's development?
    – Tanner
    Commented Feb 21, 2017 at 10:34
  • 2
    @Tanner when I saw the writing on the wall a couple of years ago, I asked that question, but although help was offered, it wasn't the sort that Jake needed. Commented Feb 21, 2017 at 10:37
  • @JackDouglas fair enough, just thought I'd ask... you know, reinventing the wheel n all. good luck, would be interested to see how it develops.
    – Tanner
    Commented Feb 21, 2017 at 10:54
  • 2
    @Tanner thanks, feel free to post feature requests here if you have ideas. Commented Feb 21, 2017 at 11:10
  • Forgive my ignorance, but what are SQLfiddle/DBFiddle? I followed the links but they didn't have any explanatory text. I also couldn't find any reference on DBA.SE about them.
    – BradC
    Commented Feb 23, 2017 at 16:37
  • @BradC Try this one: dbfiddle.uk/… the point is that you can make a reproducible test case demonstrating a question or problem, and then others can tinker with it (try changing the sql in the link in this comment) Commented Feb 23, 2017 at 17:12
  • @BradC also, there is a bit of documentation on the home page for each RDBMS: dbfiddle.uk/?rdbms=sqlserver_next Commented Feb 23, 2017 at 17:13
  • 1
    @JackDouglas: Others who don't have the target dbms installed can tinker. That's the big deal for me. I'd usually rather see the SQL in the question, myself. There's no reason people can't include SQL in the question and in a fiddle, but that's not as common as I would like it to be. Commented Feb 28, 2017 at 16:49
  • 6
    The site has evolved. By now, in all modesty, I'd like to say it's absolutely marvellous. Commented Apr 10, 2017 at 1:18
  • 1
    @lad2025 thanks for spotting that bug, now fixed. Regarding db support, pg11 will be added soon, but Oracle 12c probably never as there is no XE version. 18c XE is thought to be coming up (possibly in July) and if that materializes I will add it. Commented May 28, 2018 at 8:36
  • 5
    @Mitch both dbfiddle and my church are intended to help people, and both are the product of a lot of effort. I don't push either on anyone — and I hope to have the same respect shown to me by those who believe differently. Commented May 30, 2018 at 9:39

50 Answers 50

1
2
1

I got a problem with MySQL when I wanted to execute more statements in one field.

Please have a look at this working example (Postgres): https://dbfiddle.uk/?rdbms=postgres_9.6&fiddle=a0fc52d4e45e4d925b428fabcdee70f5

Now I changed the DBMS into MySQL and tried the same: https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=a0fc52d4e45e4d925b428fabcdee70f5

That wasn't working. But if I split the statement into one field each, it is working: https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=b6166ff71140b5957794f1f6c9fb9780

Why does the multi execution work with Postgres but not with MySQL?

1
  • db<>fiddle's design philosophy is against parsing the SQL you enter at all (the one exception being the 'split batch' function, but that is really peripheral to the main working of the site). In other words, this behaviour is inherited from the database itself, or the drivers used to access the DB. There is either something about MySQL or something about the MySQL driver for PHP causing this. It may well be related to this: stackoverflow.com/a/13982705/6854914 but it looks like there are pros and cons. Commented Sep 29, 2018 at 11:14
1

First, thank you for the site, it's a very useful tool.

Recently MySQL 8.0 introduced JSON_TABLE, however, it's currently not possible to use it in dbfiddle.uk.

See dbfiddle.

6
  • Thanks wchiquito, after a bit of digging I found there is a bug fixed in 8.0.13, which is not yet released. See on bugs.mysql.com (last comment in particular) and the 8.0.13 changelog — If you ping me here when 8.0.13 is released I'll update the back-end! Commented Sep 5, 2018 at 13:44
  • 2
    I've upgraded to 8.0.13 and it's all working now :) Commented Oct 23, 2018 at 15:22
  • @JackDouglas: Everything working as expected. Thanks for the quick update.
    – wchiquito
    Commented Oct 25, 2018 at 22:02
  • @JackDouglas: It seems that MySQL 8.0 has some problem, it does not execute sentences. Thanks.
    – wchiquito
    Commented Nov 9, 2018 at 11:50
  • apologies it was down for a while — but now working again. Commented Nov 19, 2018 at 18:12
  • @JackDouglas: Excellent, thanks.
    – wchiquito
    Commented Nov 24, 2018 at 9:16
1

There are problems in the display of space / empty string / NULL value:

 VALUES
  (1, 'foo')
, (2, '')
, (3, NULL)
, (4, '   ')
, (5, '|   |');

/*
column1 | column2
------: | :------
      1 | foo    
      2 |        
      3 |        
      4 |        
      5 | |   |  
*/

VALUES
  ('foo')
, ('')
, (NULL)
, ('   ')
, ('|   |');

/*
| column1 |
| :------ |
| foo     |
|         |
|         |
|         |
| |   |   |
*/

dbfiddle here

In the online display:

  • Note the collapsed row 2 for the empty string in the second SQL field - in the fiddle, not here.

In the markup:

  • Some way to distinguish rows 2, 3 and 4 would be useful.

I sharpened the demo to include single quotes and <tag>):

VALUES
  ('<tag>')
, (NULL)
, ('')      -- empty string
, ('''''')  -- actual single quotes
, ('   ');  -- spaces

/*
| column1 |
| :------ |
| <tag>   |
|         |
|         |
| ''      |
|         |
*/

dbfiddle here

Maybe rendering with a <pre> block would be an improvement? Would also take care of the comments you mentioned.

| column1 |
| :------ |
| <tag>   |
| null    |
| ''      |
| ''      |
|         |

You'd have to escape <. I used &lt; above ...

Included your italic null, added italic single quotes for empty string. May be hard to distinguish from literal single quotes. But still an improvement, because the distinction between empty string and space is more important because it's a more common problem.

All spaces remain to be solved ... Some corner cases are hard to solve. Most clients have a hard time to get it right.

The only change I am convinced is good is the italic null. The rest is just ideas ...

See this related meta-post:

8
  • I can put an italic *null* in row 3 for the markdown too, but I can't think of a good way of distinguishing rows 2 and 4, do you have a suggestion? Commented Mar 16, 2017 at 8:24
  • @JackDouglas: Italic null sounds like a good idea. I added some more above. Commented Mar 16, 2017 at 12:44
  • I found this was much harder than I anticipated due to the way SE handles code blocks and syntax highlighting. The only solutions I found that retained syntax highlighting also separated the SQL and result table into two block visually which I think isn't good. In the end, all I've done is add a plain 'null' for nulls in the markdown (no way of disambiguating the text "null"), and added a &nbsp; where there is an empty string in the tabular output to prevent rows collapsing: dbfiddle.uk/… Commented Mar 16, 2017 at 17:00
  • 1
    @JackDouglas: I expected this to be harder than it looks ... Separating code and results does not seem so bad to me. I often do that on purpose in my answers. Commented Mar 16, 2017 at 17:11
  • What do you think of this output? i.sstatic.net/GJ0Xu.png Commented Mar 16, 2017 at 17:22
  • I mean just from the POV of the blockquote to separate the statement/result pairs Commented Mar 16, 2017 at 17:23
  • I think that's good. Commented Mar 16, 2017 at 22:16
  • 1
    OK, I've implemented that on a trial basis, we'll see if others agree it is an improvement. I think it is, and I'm delighted that the syntax highlighting works, there is no need for the /* */ commenting, and we can have italic null in the markdown output, all at once. Thanks a lot for the input Erwin. Commented Mar 17, 2017 at 9:54
1

I have to say it once again: db<>fiddle is simply the best.


I have a small request. Could you add traceflag 460 to startup parameters after you patch SQL Server with the newest cumulative update?

Current CU of SQL Server 2017 is CU9.

db<>fiddle demo

SELECT SERVERPROPERTY('ProductUpdateLevel'),@@version;
-- CU9

I would like to be able to use:

Improvement: Optional replacement for "String or binary data would be truncated" message with extended information in SQL Server 2017

Which was previously intended to be SQL Server 2019 feature Truncation error message improved to include table and column names, and truncated value (CTP 2.1)

3
  • 2
    We've applied CU12 and added traceflag 460; here is a demo fiddle Commented Dec 3, 2018 at 22:21
  • @JamesDouglas Once again, huge kudos for all your efforts and help.
    – lad2025
    Commented Dec 4, 2018 at 20:19
  • @JamesDouglas see how this error is displayed in Firebird: dbfiddle.uk/… - I mean, the error is supposed to be on two or maybe three separate lines, but it was fused into one continuous line, and without separators it is harder to read... Commented Sep 26, 2019 at 16:18
1

On SO in the PostgreSQL section there are often PostGIS questions. At the moment I don't know any fiddle engine which supports this framework. So as a suggestion: Wouldn't it be great to install the PostGIS frame along with your PostgreSQL instances?

3
  • I've not done this before but it turns out it's reasonably straightforward as the same PG repo for postgres also contains PostGIS. Please try it out on pg11: dbfiddle.uk/… Commented Oct 31, 2018 at 10:55
  • Great, works like charm :) Will you activate it on previous versions too?
    – S-Man
    Commented Oct 31, 2018 at 12:05
  • We added it to 10 and 9.6 too — I don't think we'll add it to any of the older versions though. Commented Mar 19, 2019 at 17:02
1

Bug for MySQL-8.0

SELECT
  json_tb.item_id,
  json_tb.model_number,
  json_tb.quantity
FROM JSON_TABLE
(
'[{"item_id":1,"model_number":"MFJA53","quantity":4},{"item_id":2,"model_number":"HSRHJN5","quantity":null},{"item_id":3,"model_number":"FAFAF1","quantity":345}]'
, "$[*]"
COLUMNS
(
item_id int PATH "$.item_id",
model_number varchar(100) PATH "$.model_number",
quantity int PATH "$.quantity"
)
) json_tb

Returns:

SELECT command denied to user 'fiddle_SMYHCBMIQRDQGWHKBNDS'@'localhost' for table 'json_table'

json_table is a function more than a table (ref: JSON_TABLE function manual)

1
  • 1
    This was reported earlier and we were waiting for MySQL to release a fix, but thanks for bringing it up again as it prompted me to check back and discover the release was ready. It should all be working now. Commented Oct 23, 2018 at 15:24
1

Attempting to run the following two SQL Server batches on any available db<>fiddle version:

SET LANGUAGE Italiano;
SELECT CONVERT(datetime, '2019.06.30', 0);
SET LANGUAGE Italiano;
SET DATEFORMAT YMD;
SELECT CONVERT(datetime, '2019.06.30', 0);

db<>fiddle screen capture

Produces an error:

enter image description here

The code runs 'successfully' in SSMS producing the expected message and error for the first statement:

L'impostazione della lingua è stata sostituita con Italiano.
Msg 242, Level 16, State 3, Line 2
La conversione di un tipo di dati varchar in datetime ha generato un valore non compreso nell'intervallo dei valori consentiti.

The second statement does not produce an error, but does produce the informational message:

L'impostazione della lingua è stata sostituita con Italiano.
2
  • Running just the first one fails on most but shows an error on 2017: dbfiddle.uk/…. Do you get the same error in SSMS? Commented Jul 5, 2019 at 9:07
  • Yes the error is expected - answer updated to clarify (sorry about that)
    – Paul White Mod
    Commented Jul 5, 2019 at 9:13
1

Would it be possible to show multiple outputs in one SQL field? At the moment if you have two SELECT statements only one will be shown in the results. https://dbfiddle.uk/?rdbms=postgres_9.6&fiddle=c17a17e3a448a08adc851b21d0bea5d2

For my Postgres answers I like to do these steps: CREATE TABLE, INSERT data and SELECT * FROM new_table to show how the origin table and its content look like. For multiple tables I have to use two section only for the SELECT part.

It's nothing critical, I know. But it would be nice candy I think!

2
  • I'm afraid I don't think that's an easy thing to do with the postgres PHP driver we are using. It works fine with SQL Server: dbfiddle.uk/…. You can split the batch automatically with one of the icons inside the hamburger on the right but I'm not sure that is what you want. Commented Oct 31, 2018 at 14:43
  • btw this works now — I forgot to mention I found a bug in the driver and realised there was a workaround Commented Jul 18, 2019 at 10:10
1

It seems there is a bug with DB-fiddle regarding detecting or reporting of Firebird errors.

See https://dbfiddle.uk/?rdbms=firebird_3.0&fiddle=57729b31e0a5019aea68a136638d9f50

See https://stackoverflow.com/questions/58096187

Last query should generate an internal Firebird error (as Numeric is capped with 18 digits in FB 2/3 and 18-4*4=2 is not enough to contain the calculation result of 1875).

DB fiddle displays neither error nor query result.

14
  • This looks like a Firebird bug to me as a resultset is returned (albeit empty) rather than an error generated: dbfiddle.uk/… Commented Sep 26, 2019 at 14:05
  • @JackDouglas the error IS generated, try local tools like FlameRobin or IBExpert or even console iSQL tool of the Firebird package. The resultset is not a static object, it is a vessel to be filled with data, as you fetch next rows. It is fetching the specific row that leads to overflow and error generation. You may avoid fetching all/any rows, but you still will have some rows and the resultset itself usable as meta-data. So, I see no bag on FB part there. Commented Sep 26, 2019 at 14:15
  • Imagine fetching f1 / f2 from a table having rows like 1; 1, 2; 2, 3; 3, 0; 0, 4; 4 - obviously only fetching the 4th row will trigger the error, prior rows can be perfectly fetched! Think about Firebird as a lazy evaluator, which only makes actual actions (and has chance to trigger errors) when (whether) was actually asked by client to do it. Before the erratic row was fetched - there was no condition of error, thus no reason to deny creating the yet empty resultset. Commented Sep 26, 2019 at 14:16
  • 2
    ah, it looks like it is exposed as a PHP warning row by row by ibase_fetch_row, thanks. Commented Sep 26, 2019 at 14:22
  • yep, in my division by zero example you might even both display the starting part of the output and THEN display an error. It is not either-or :-) Commented Sep 26, 2019 at 14:25
  • WEIRD result: I just clicked yours then my link, and the tab with my link acted weirdly. It had "ok" mark on the #1 query and sensible result on #3 query, but "error table does not exist" on #2 and #4. Then I manually pressed "run" and it went all ok. I reloaded page, and (I suppose being cached now) it loaded ok again. But, be it because I clicked both your and mine links in almost the same time, or be it because I did not clicked my own link for hourse and it needed warming up, dunno, but initial load was the errors... Commented Sep 26, 2019 at 14:29
  • because Firebird isn't heavily used I'm making changes to the code in prod — that will explain the weird results. If bad results are cached the 'run' should clear them. Commented Sep 26, 2019 at 14:30
  • ah, ok, could be then, just did not expected so tight a race conditions :-D Commented Sep 26, 2019 at 14:31
  • I think the issue is now fixed, though I think we expected this to produce a good row and then an error but it does not: dbfiddle.uk/…. Commented Sep 26, 2019 at 14:31
  • OT: notice how I had to inject a "hackish" query to learn the Firebird version. Perhaps it might make sense to always report the server version somewhere at [age bottom after "run" pressed ? Commented Sep 26, 2019 at 14:36
  • This works: dbfiddle.uk/… - so I guess the case is about datatypes: integer being up-lifted to the same Numeric, and then we have the same problem of too few digits left. Your site does not report data types in result sets, i'll try this locally in FB 2.1.7/IBExpert Commented Sep 26, 2019 at 14:38
  • Oh, sorry, pal, I am really really stupid with this issue! consider this: dbfiddle.uk/… The trouble is obvious, as all union-ed queries share the same result set - the datatypes are stretched for every columns according to the most needy query. In your link - the LAST one was forcing the 6-digits (before dot) wide Numeric(18, 4*3) - which was not enough for 60^4 albeit was enough for 60^3. Remove the last query - and the datatype falls back to Numeric(18,3*3) which has 9-digits and is enough for 60^4 to fit Commented Sep 26, 2019 at 14:39
  • Yeah, here goes another proof :-) - dbfiddle.uk/… Commented Sep 26, 2019 at 14:45
  • Ok thanks that makes sense now. So it stops at the first error: dbfiddle.uk/… Commented Sep 26, 2019 at 19:20
1

Few UI notes.

  1. MS IE 11 rendering is garbled (who would have thought :-D ) - the first vertical splitter is too high, and the "run" button is too narrow.

enter image description here

If anything, "MSIE6 compatibility mode" is not fixing it but makes a total mess :-)

  1. Feature Request, can you make the vertical splitter (when it is vertical) to be user-draggable left and right? Perhaps it is to be a fiddle-global (page-global) thing, affecting all the queries at once - less flexible, but more eye-candish and simple to control. Perhaps something like this: http://cross-browser.com/x/examples/xsplitter.php
1
  • 1
    I'm not convinced it's worth the effort to support IE11 — but I will look into making the vertical splitter user-draggable, thanks for the xsplitter link! Commented Oct 18, 2019 at 18:33
1

When working with Firebird, you cannot create a VIEW.

Error:

unsuccessful metadata update CREATE VIEW VW_TEST failed There is no privilege for this operation

DB Fiddle

2
  • Thanks Anton, that's fixed — but there are probably other privileges we should consider granting, please let me know if you run into any. Commented Oct 11, 2019 at 19:28
  • @JackDouglas Thank you Commented Oct 16, 2019 at 11:50
1

Running into a display bug with SQL Server (any version) related to the precision displayed for DATETIME2 values.

This dbfiddle should be pretty much self-explanatory, but regardless of the precision defined, the output only shows the value up to the second.

2
  • FYI - you prompted some further discussion with this post over on this ta.xyz thread in case you're interested Commented Jan 14, 2020 at 9:06
  • 1
    Hi John, the output still isn't perfect, but this fiddle shows things are better than before! Commented Jan 14, 2020 at 22:41
1

Now tracked here


The 19.2 release makes it look like integrating it might be relatively easy, would you be interested in adding CockroachDB as a supported platform?

The cockroach demo 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 :)

2
  • That does look interesting. Core is free, but the 'demo' (which seems like it might be ideal) loads a temporary enterprise license — but I can't find out whether usage is restricted except for the 1 hour time limit, do you know? Commented Nov 13, 2019 at 22:41
  • @JackDouglas I've just heard back from my account rep & confirmed that this usage is within the licensing guidelines 😄 Commented Nov 21, 2019 at 10:54
0

SQLFormat has an API (and code) to clean up syntax to make it readable.

0

I am missing the possibility to copy the table results for the SO editor. If I simply copy the table I end up with things like that:

user_id     check_date  day     time_in     time_out    hours   status
53  2018-07-16 00:00:00+01  Monday      08:15:17    09:38:03    25.3794444444444    present
53  2018-07-17 00:00:00+01  Tuesday                 absent
53  2018-07-18 00:00:00+01  Wednesday   06:34:13    08:05:17    1.51777777777778    present

The columns and values are not really aligned together. So I always have to append a manual formatting step (e.g. converting tabs into spaces):

user_id   check_date               day         time_in    time_out   hours              status
53        2018-07-16 00:00:00+01   Monday      08:15:17   09:38:03   25.3794444444444   present
53        2018-07-17 00:00:00+01   Tuesday                                              absent
53        2018-07-18 00:00:00+01   Wednesday   06:34:13   08:05:17   1.51777777777778   present

In SQLFiddle you can chose the output between (table, plaintext, markdown). Even plaintext looks much better and can be taken for copying into SO without any addional work:

| user_id |           check_date |       day |  time_in | time_out |                hours |  status |
|---------|----------------------|-----------|----------|----------|----------------------|---------|
|      53 | 2018-07-16T00:00:00Z | Monday    | 08:15:17 | 09:38:03 |   25.379444444444445 | present |
|      53 | 2018-07-17T00:00:00Z | Tuesday   |   (null) |   (null) |               (null) |  absent |
|      53 | 2018-07-18T00:00:00Z | Wednesday | 06:34:13 | 08:05:17 |   1.5177777777777777 | present |

Edit: dbfiddle markdown syntax

> user_id | check_date             | day       | time_in  | time_out | hours               | status 
> ------: | :--------------------- | :-------- | :------- | :------- | :------------------ | :------
>      53 | 2018-07-16 00:00:00+01 | Monday    | 08:15:17 | 09:38:03 | 25.3794444444444    | present
>      53 | 2018-07-17 00:00:00+01 | Tuesday   | <em>null</em>     | <em>null</em>     | <em>null</em>                | absent 
>      53 | 2018-07-18 00:00:00+01 | Wednesday | 06:34:13 | 08:05:17 | 1.51777777777778    | present

As you can see, the second row is not really aligned. Furthermore you can find the <em> tags and things like that.


Added by Jack:

select 1, null;
?column? | ?column?
-------: | :-------
       1 | null    
8
  • have you tried the 'markdown' link at the top? Commented Oct 31, 2018 at 14:41
  • Yes, of course. But it creates markdown syntax which is not a really good result (appending example)
    – S-Man
    Commented Oct 31, 2018 at 14:45
  • The <em> tag is the only one — and it's there to distinguish between "null" (the string) and an actual null result. I guess it would be nice if the alignment took that into account, but does it really matter for SO? Also, when I paste in the markdown directly from db<>fiddle to an SO answer it doesn't look like yours: I'll edit an example into your question. Commented Oct 31, 2018 at 15:12
  • Yours is indented and missing the <pre> tags Commented Oct 31, 2018 at 15:14
  • 1
    @JackDouglas Thanks for you great tool. But I still miss the feature of a plain text output. I have different use cases where I need a good text style as in the psql console. The only fiddle engine that has it integrated is SQL Fiddle (as shown above). I really don't need markdown, just simple table lines. That's one of the last reasons when I have to use SQL Fiddle instead of your great tool. I would be really appreciated and it would really really help me a lot if you could integrate such an output option as well. SQL Fiddle also offers the 3 versions.
    – S-Man
    Commented Jan 20, 2019 at 9:08
  • Is there any news on this one? Although I love your tool, but for textual representation without markdown syntax I have to use another tool which is quite frustrating. DBeaver improved its support for great text output in version 6.
    – S-Man
    Commented Jul 18, 2019 at 8:24
  • still thinking about this — you can paste the markdown into SO and then copy the text output from there (just like you can copy the "added by Jack" table directly from the output above). Does that give you the kind of text output you need (albeit with an extra step)? Commented Jul 18, 2019 at 9:46
  • Hm, yes this could be a work around... But the extra step does not feel very good imho :D
    – S-Man
    Commented Jul 18, 2019 at 10:03
0

Could you make the default number of lines to something like 10 instead of 1?

1
  • I don't think that's an improvement — I prefer to see more batches on the page if they fit. Commented Sep 24, 2019 at 11:40
0

Feature request: Firebird Query plans

The topic post features a screenshot with MS SQL query with the query plan rendered. Firebird also has plan output feature, and it was enhanced in Firebird 3 to be more human-readable.

I wonder if PHP FB library has or can be modified to have support for fetching query plan as well as resulting data.

5
  • I think this is only going to happen if Firebird exposes a 'pure sql' means of retrieving the plan. None of the other backends have any special code to achieve this. Commented Sep 26, 2019 at 19:28
  • @JackDouglas you mean like "all other backends expose plans to db<>fiddle already" or like "db<>fiddle only displays plans for those back-ends, that have SQL-level acccess to it" ? Commented Sep 26, 2019 at 20:38
  • I mean the latter — db<>fiddle has a very simple codebase, for example it does not parse SQL at all (except in the front end when splitting batches). Adding specialised code for query plans would go against that philosophy. There'd have to be a very strong reason to persuade me to do it. Commented Sep 27, 2019 at 6:59
  • An example case where I've already done something 'against my rule' is for the graphical query plan for SQL Server. However SQL Server is the most popular database on db<>fiddle and I take that into account too. Commented Sep 27, 2019 at 7:01
  • i hoped you could submit a patch updtream, to PHP itself :-D Commented Oct 5, 2019 at 18:26
0

Feature Request: display server version. Sometimes tools like db<>fiddle are used to test some edgy query on different server versions, like looking for a bug in either query or server.

Usually database engines have some means to query version, but they may be not exposed to SQL or may require some in-depth knowledge.

It would be nice if after pressing "Run" button the DBMS version, as detailed as reasonable, was displayed for example in left bottom corner of the page.

In case of Firebird it can be obtained:

7
  • Firebird's idiomatic way of showing the version is a bit odd but good enough for the rare cases when you want to draw attention to it I think. Commented Sep 26, 2019 at 19:29
  • i think it actually to be useful for every server, notice the question about MS SQL ans specific Cumulative Update, etc. And "idiomatic way" does not make differences between different builds of 3.0.5.x, which perhaps does matter for not yet released work-in-progress software Commented Sep 26, 2019 at 20:10
  • @JackDouglas I see you finally did it, though in quite a different way! What can I say - great option! I did not think of such an implementation :-D Commented Oct 4, 2019 at 16:44
  • Sorry, I'm not sure what you mean? Commented Oct 4, 2019 at 16:48
  • Now when you open new fiddle for any RDBMS - it starts not with a clean slate but with a RDBMS-specific version query. For the "end-user" of the new query the result is mostly the same. For readers of already existing fiddles it might be different, depending on the fiddle developer. Commented Oct 4, 2019 at 16:53
  • Actually that's always how it worked — but only if you go to the home page and don't press 'run'. Not 100% intuitive I admit Commented Oct 4, 2019 at 17:38
  • maybe then add button "check rdbms version" that would explicitly do it ? Commented Oct 5, 2019 at 18:21
0

A couple of nice-to-haves would be:

Ctrl-Enter to run the code rather than having to use the mouse?

and also, after running the code, can we be dropped at the end of the page? Normally, one tries stuff, progresses, then adds more - so the focus of interest is normally at the bottom of the page. It's irritating to have to scroll down each time and it would be deadly if we could be dropped to the bottom of the page.

Informix?

As I said, these are nice to haves and kudos for your amazing achievement so far - I particularly appreciate the fact that you cater for Firebird - a totally underrated and overignored system that (like PostgreSQL) is (vastly) superior to MySQL (<rant> how is it the most successful of the F/LOSS servers despite being the worst of them? </rant>...) - is the code up on GitHub or similar yet - you did mention that at one point.

Finally, could you please make one-off payments possible? I don't like the idea of recurring payments and would just like to make a (small) one-off donation for the excellent service you provide to the community.

EDIT (22/11/2019):

Hi again Jack, a few things too big to put into a comment.

  • The Ctrl-Enter thing works but, as I said earlier, erratically. It seems to drop you somewhere in the middle of the page regardless of where you were last editing - which can in fact be confusing! I've noticed this behaviour on Windows, Linux and Mac Airbook.

  • EXPLAIN EXTENDED doesn't work on MySQL 8 but does on MySQL 5.7? EXPLAIN does work for both.

  • I discovered the above issue when looking for timings for MySQL. They don't come with the EXPLAIN EXTENDED whereas they do with PostgreSQL (gotta love it!). Would there be a way of including timings by default?

  • With the Microsoft Edge browser (for the 5 people who use it! :-) ), if you try and copy and paste the results from a db<>fiddle query into the StackExchange text boxes, it looks like this (compare with the answer and the fiddle it was copied in from using Chrome):

Every single column name/field becomes a new line:

tid_1
tid_2
loc_1
loc_2
ldt_1
ldt_2
diff
Mon
Mon
Hom
Hom
2019-10-22 10:27:40
2019-10-22 11:22:40
3300
Mon
Mon
Gas
Gas
2019-10-22 12:43:00
2019-10-22 13:43:00
3600
Mon
Mon
Hom
Hom
2019-10-22 16:43:00
2019-10-22 17:43:00
3600
Mon
Mon
Hom
Hom
2019-10-22 20:43:00
2019-10-22 20:56:00
780

As for Informix, I wrote to them:

Dear Sir or Madam, I wish to use your Informix Innovator-C Edition for a not-for-profit project and am wondering if the licence will permit this? The site/project is one which permits users to test SQL against servers to which they may not have (immediate/current) access (small data volumes). I believe that such usage would be covered by the "free for development, testing, and small production use." section of the licence (from here: https://www.ibm.com/products/informix/editions), but would just like to confirm. Should you require any further information, please don't hesitate to contact me. Best regards,

and they replied:

Thank you for contacting the IBM Service Center. I refer to your e-mail received 05.11.2019

You have reached the IBM UK General Enquiries.

With your inquiry please contact our Support team for Informix products on +44 800 013 0333. Please note this department is only reachable via phone as it hasn’t got a general email address.

Or visit our website on http://www-306.ibm.com/software/data/

Or you can also contact our Software Team on +44 239 228 2340

If we can be of any further assistance please do not hesitate to contact us at [email protected] Any requests sent through to the representative directly will not be actioned immediately.

Kind Regards,

Pavol

I tried ringing but got put on hold and as it's an international call for me, I didn't fancy racking up large bills. If you are UK based (?) maybe you might fancy ringing the 0800 number (free from UK AFAIK)? This isn't a big deal for me personally - I haven't used Informix in years, but it was my first RDBMS (and a good one), so there's a residue of affection but it appears to be slowly withering on the vine in any case. A quick check shows 68 questions all told with the Informix tag, slightly behind Firebird with 77.

Should you require any further information/testing, please don't hesitate to ping me. Again, I would like to thank you for your sterling efforts on behalf of the community to date.

6
  • That's great! A -1 for this post. I just wish the person who downvoted me had the decency to tell me why. I was suggesting nice-to-haves and not demanding anything - as it is, dbfiddle.uk is a great contribution to the community - which I did specifically mention in the point/question. Ah well...
    – Vérace
    Commented Nov 2, 2019 at 6:48
  • Ignore the DV Verace, someone could have got the wrong end of the stick or could just be trolling — we'll never know unless they tell us. Maybe a big MySQL fan! Anyway, I think these are good suggestions and I've added CTRL-Enter to run, and done something a bit different to scroll position; rather than always scrolling to the bottom, I just save and restore the current scroll position. I think that's going to be better in most cases, but let me know what you think (and whether CTRL-Enter actually works — I've only tested Cmd+Enter on my mac!) Commented Nov 2, 2019 at 12:51
  • 1
    Thanks for your kind remarks - but the downvote was before I added the bit about Firebird/MySQL. Super-kudos for your prompt reply and implementation of the Ctrl-Enter - that works a treat. I've messed around with Windows 10, Chrome and the cursor position after Run appears to work erratically - haven't been able to nail down the exact conditions under which it happens and when it doesn't quite work. I'm off to the girlfriend's later so I won't be testing this evening :-) I will take a look tomorrow and try and figure out the way it's working on my setup. Can check on Linux-will report back!
    – Vérace
    Commented Nov 2, 2019 at 13:43
  • re Informix, Express Edition doesn't appear to be free — is there a suitable free edition? Commented Nov 4, 2019 at 10:42
  • You probably want the Innovator-C edition ibm.com/products/informix/editions -- free for "small production".
    – mustaccio
    Commented Nov 5, 2019 at 2:57
  • Not sure if you're notified of every edit to answers in the thread - I've added a couple of things to my original post - lemme know if you need anything.
    – Vérace
    Commented Nov 22, 2019 at 16:14
0

I'm so excited I found dbfiddle! What a wonderful service to have at hand, thank you! I was especially floored by how it's already got CU1 applied to SQL Server 2019, or Firebird 3.0.5, both released mere days ago. However, I'm here with a bug report, for Firebird specifically.

There's something wonky going on with LIST(), Firebird's version of GROUP_CONCAT() in MySQL/SQLite, or STRING_AGG() in Postgresql/MS SQL Server. It's supposed to return a text string, but on dbfiddle I keep getting odd binary values.

Here's a simple example dbfiddle:

select list(t) from (select 'hello' as t from rdb$database union select 'world' from rdb$database);
| LIST               |
| :----------------- |
| 0x0000000100000000 |

db<>fiddle here

On any system I have, this returns the expected 'hello,world' not 0x0000000100000000 which I honestly can't even imagine where that might be coming from. An errant UDF overriding the built-in function?

2
  • Can you repost this on our current bug tracker please? At some point we will probably move to a GitHub issue tracker but we aren't there yet… Commented Jan 14, 2020 at 11:16
  • The answer is right there in the linked documentation: "Result type: BLOB".
    – mustaccio
    Commented Jan 15, 2020 at 18:59
1
2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .