question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

postgresql custom types (nested composite, enum) not supported in various editor functions

See original GitHub issue

DBeaver 21.2.3

Recent DBeaver versions have improved composite type support for Postgresql quite a bit, but there are still broken things unfortunately. The following features in the editor do not work for nested composite types:

  • ‘Generate SQL -> INSERT’
  • ‘Duplicate Row’ In previous versions, this didn’t work for any composite type, so there’s definitely been an improvement here already (#13351, #13102) but the nested composite types seem to have been overlooked in these improvements.

To reproduce:

create schema test;
create type test.ct as (a int, b int);
create type test.ct2 as (a test.ct, b int);
create table test.t1 (a int, b test.ct2);
insert into test.t1 (a, b.a.a) (values (1, 1));
-- now disconnect and connect so that dbeaver refreshes the metadata cache
select * from test.t1;
-- now right click on a row and choose 'Generate SQL -> INSERT'

This still generates incorrect syntax (array syntax for a composite type):

INSERT INTO test.t1
(a, b)
VALUES(1, '("[1, null]",)');

A second problem arises when using enums inside a schema. Consider the following:

create type test.en as enum ('ab', 'bc');
create table test.t3 (a int, b test.en);
insert into test.t3 (values (1, 'ab'));
-- now disconnect and connect so that dbeaver refreshes the metadata cache
select * from test.t3;
-- now right click on a row and choose 'Generate SQL -> INSERT'

This generates the following SQL (note the missing schema qualifier before en):

INSERT INTO test.t3
(a, b)
VALUES(1, 'ab'::en);

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
phillip-haydoncommented, Nov 24, 2021

Hmmm, let me re-install tomorrow (it’s 8:30pm and I’m tired). I upgraded from a very old version of DBeaver. Maybe it’s just bunged.

Will let you know. Thanks for checking.

0reactions
Matvey16commented, Dec 8, 2021

Verified

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation: 15: 8.16. Composite Types - PostgreSQL
A composite type represents the structure of a row or record; it is essentially just a list of field names and their data...
Read more >
Unsupported PostgreSQL functions - Amazon Redshift
Lists the PostgreSQL functions that are not supported in Amazon Redshift.
Read more >
Data model (Reference) - Prisma
Learn about the concepts for building your data model with Prisma: Models, scalar types, enums, attributes, functions, IDs, default values and more.
Read more >
更新记录 - OpenXava
Driver versions in doc and new projects upgraded for MySQL, PostgreSQL, ... Fix: Upload editor property (like @Files) does not fill all width...
Read more >
SQl Server to Aurora PostgreSQL Migration Playbook - Awsstatic
Migrate to: Aurora PostgreSQL User Defined Types ... Note that not all SQL Server features are fully compatible with Aurora PostgreSQL, ... Nested...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found