# Is crateDB support mixed array type insertion and querying of the column

**URL:** <https://community.cratedb.com/t/is-cratedb-support-mixed-array-type-insertion-and-querying-of-the-column/809>\
**Category:** CrateDB\
**Created:** [September 17, 2021, 4:18am UTC](https://community.cratedb.com/t/is-cratedb-support-mixed-array-type-insertion-and-querying-of-the-column/809 "2021-09-17T04:18:16Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ajaysamdyan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/ajaysamdyan/32/388_2.png) [@Ajaysamdyan](https://community.cratedb.com/u/Ajaysamdyan)\
**Post date:** [September 17, 2021, 4:18am UTC](https://community.cratedb.com/t/is-cratedb-support-mixed-array-type-insertion-and-querying-of-the-column/809/1 "2021-09-17T04:18:16Z")

</div>

Dear Team

I had performed a test using mixed array type object of ignored case. I have found that the value of the column index disappeared for index position 2.

Steps to reproduce:

```sql
CREATE TABLE t (an_array_attr OBJECT(ignored));
INSERT INTO t (an_array_attr) VALUES ( '{"value": ["wada", ["wada", false], 3]}'::object );

```

Here, `["wada", false]` disappeared in the test result. It only shows the `"wada"` and `3` in the output.

So, i only want to know about this unusual behavior of crate db.  
Is it a cratedb bug or cratedb not support the mixed array type?

If cratedb does not support the mixed array type than, how could the below test succeed:

```sql
INSERT INTO t (an_array_attr) VALUES ( '{"value": ["yo!", true]}'::object ); 
INSERT INTO t (an_array_attr) VALUES ( '{"value": [{"k": 1}, 2]}'::object ); 

```

These test cases are failed in case of dynamic insertion.

Kindly help me to understand the exact behavior.

---

<div class="post-metadata">

**Author:** ![amotl](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/amotl/32/617_2.png) [@amotl](https://community.cratedb.com/u/amotl)\
**Post date:** [September 17, 2021, 8:29am UTC](https://community.cratedb.com/t/is-cratedb-support-mixed-array-type-insertion-and-querying-of-the-column/809/2 "2021-09-17T08:29:54Z")

</div>

Dear @Ajaysamdyan,

thank you for writing in. To give the community more context about your question, I would like to add the backlink to [Typed Arrays · Issue #147 · orchestracities/ngsi-timeseries-api · GitHub](https://github.com/orchestracities/ngsi-timeseries-api/issues/147). We made friends with the people conceiving FIWARE QuantumLeap the other day already. Cheers!

With kind regards,  
Andreas.

---

<div class="post-metadata">

**Author:** ![proddata](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/proddata/32/1379_2.png) [@proddata](https://community.cratedb.com/u/proddata)\
**Post date:** [September 17, 2021, 8:42am UTC](https://community.cratedb.com/t/is-cratedb-support-mixed-array-type-insertion-and-querying-of-the-column/809/3 "2021-09-17T08:42:21Z")

</div>

Hi @Ajaysamdyan

```sql
CREATE TABLE t (an_array_attr OBJECT(ignored));
INSERT INTO t (an_array_attr) VALUES ( '{"value": ["wada", ["wada", false], 3]}'::object );

```

By

> Here, [“wada”, false] is disappeared in test result.

are you refering to the admin ui?  
It seems like the Admin UI indeed has a bug, but the data should still be there (turned off formatting)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/crate/original/1X/32f47d73e513161dc983001b96a665b98b091b25.png) ![image](https://us1.discourse-cdn.com/flex020/uploads/crate/original/1X/d7366e272333ab0baee210fd46ed1d883fd3d182.png)

With `OBJECT(IGNORED)` you could store pretty much any kind of JSON that is encapsulated on the top-level in curly brackets

---

<div class="post-metadata">

**Author:** ![Ajaysamdyan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/ajaysamdyan/32/388_2.png) [@Ajaysamdyan](https://community.cratedb.com/u/Ajaysamdyan)\
**Post date:** [September 17, 2021, 8:52am UTC](https://community.cratedb.com/t/is-cratedb-support-mixed-array-type-insertion-and-querying-of-the-column/809/4 "2021-09-17T08:52:07Z")

</div>

Hi prodata, All the queries are executed by superuser “crate”, and only `["wada",false]` is missing.

---

<div class="post-metadata">

**Author:** ![proddata](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/proddata/32/1379_2.png) [@proddata](https://community.cratedb.com/u/proddata)\
**Post date:** [September 17, 2021, 8:59am UTC](https://community.cratedb.com/t/is-cratedb-support-mixed-array-type-insertion-and-querying-of-the-column/809/5 "2021-09-17T08:59:31Z")

</div>

How are you checking if the values are missing. I tried to replicate this and can see, that the **Admin UI** has a display **bug** together with formatting. However, when turning formatting off, I still can see `["wada",false]`.

Also using other clients, I can see that the array is still available.

---

<div class="post-metadata">

**Author:** ![Ajaysamdyan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/ajaysamdyan/32/388_2.png) [@Ajaysamdyan](https://community.cratedb.com/u/Ajaysamdyan)\
**Post date:** [September 17, 2021, 9:18am UTC](https://community.cratedb.com/t/is-cratedb-support-mixed-array-type-insertion-and-querying-of-the-column/809/6 "2021-09-17T09:18:33Z")

</div>

Hi prodata, which version you are using of CrateDB. i have tested it on CrateDB 4.1.4 and 4.5.1.  
Please provide me any reference like link, document etc. on how to turn off formatting.

---

<div class="post-metadata">

**Author:** ![proddata](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/proddata/32/1379_2.png) [@proddata](https://community.cratedb.com/u/proddata)\
**Post date:** [September 17, 2021, 9:23am UTC](https://community.cratedb.com/t/is-cratedb-support-mixed-array-type-insertion-and-querying-of-the-column/809/7 "2021-09-17T09:23:43Z")

</div>

> [@Ajaysamdyan](#):
>
> ```auto
> INSERT INTO t (an_array_attr) VALUES ( '{"value": ["wada", ["wada", false], 3]}'::object );
> 
> ```

I just tested it with 4.6.3 / 4.5.1 / 4.3.4

The formatting can be turned of with that checkbox marked in yellow:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/crate/original/1X/310dd61e2d6c6fcb15faf77c800c02b01109d7a1.png)

---

<div class="post-metadata">

**Author:** ![Ajaysamdyan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/ajaysamdyan/32/388_2.png) [@Ajaysamdyan](https://community.cratedb.com/u/Ajaysamdyan)\
**Post date:** [September 17, 2021, 9:31am UTC](https://community.cratedb.com/t/is-cratedb-support-mixed-array-type-insertion-and-querying-of-the-column/809/8 "2021-09-17T09:31:56Z")

</div>

Hi @prodata, yes you are right. So basically its a bug right, it should have to shows the data in format style as well?

---

<div class="post-metadata">

**Author:** ![proddata](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/proddata/32/1379_2.png) [@proddata](https://community.cratedb.com/u/proddata)\
**Post date:** [September 17, 2021, 9:44am UTC](https://community.cratedb.com/t/is-cratedb-support-mixed-array-type-insertion-and-querying-of-the-column/809/9 "2021-09-17T09:44:40Z")

</div>

I will see if this can be easily fixed and otherwise create a bug report. Thanks for making us aware about the issue 🙏

---

<div class="post-metadata">

**Author:** ![amotl](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/amotl/32/617_2.png) [@amotl](https://community.cratedb.com/u/amotl)\
**Post date:** [September 17, 2021, 10:15am UTC](https://community.cratedb.com/t/is-cratedb-support-mixed-array-type-insertion-and-querying-of-the-column/809/10 "2021-09-17T10:15:25Z")

</div>

Hi again,

thank you for figuring this out so quickly. I am happy it turned out to be “only” a bug in Admin UI. Nevertheless, as many people, including you, will go to the Admin UI for their first steps using and evaluating CrateDB, we will try to come up with a bugfix as soon as possible.

In order to track this issue, I just created [Display bug with "format results" · Issue #744 · crate/crate-admin · GitHub](https://github.com/crate/crate-admin/issues/744).

With kind regards,  
Andreas.

---

<div class="post-metadata">

**Author:** ![amotl](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/amotl/32/617_2.png) [@amotl](https://community.cratedb.com/u/amotl)\
**Post date:** [October 4, 2021, 1:17pm UTC](https://community.cratedb.com/t/is-cratedb-support-mixed-array-type-insertion-and-querying-of-the-column/809/11 "2021-10-04T13:17:07Z")

</div>

Dear @Ajaysamdyan,

the CrateDB 4.6.4 hotfix release will include Admin UI 1.19.2, which includes the fix [Added ability to correctly display nested arrays by proddata · Pull Request #745 · crate/crate-admin · GitHub](https://github.com/crate/crate-admin/pull/745) by @proddata – thanks a stack!

The Docker image is already available through `crate/crate:4.6.4`.

With kind regards,  
Andreas.
