vscode-sqltools icon indicating copy to clipboard operation
vscode-sqltools copied to clipboard

Remove duplicates from table columns

Open emil14 opened this issue 5 years ago • 13 comments

Hello! And thank you for great extension!

It would be great if we could see columns without duplicate rows. What I mean:

Screenshot from 2020-08-24 13-48-11

To me it looks like a made mistake in SQL or something. Would be great to see a single row for a single column

Thanks! :)

emil14 avatar Aug 24 '20 10:08 emil14

Another problem related to this is when I click "Generate insert query" it generates query with duplicates

INSERT INTO some_table (
    service_id,
    service_id,
  )
VALUES (
    'service_id:uuid',
    'service_id:uuid',
  );

emil14 avatar Aug 25 '20 07:08 emil14

@emil14 which driver are you using?

mtxr avatar Aug 26 '20 18:08 mtxr

@mtxr I'm using "SQLTools PostgreSQL/Redshift Driver"

emil14 avatar Aug 26 '20 20:08 emil14

I'm not able to reproduce this.

Are you using extension and latest versions?

image

mtxr avatar Aug 27 '20 02:08 mtxr

Tested on PostgreSQL 12.2 (Debian 12.2-2.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit image

mtxr avatar Aug 27 '20 02:08 mtxr

@mtxr I'm using the same versions of "SQLTools" and "PostgreSQL/Redshift Driver" on Ubuntu 18.04.5 LTS

emil14 avatar Aug 27 '20 16:08 emil14

Screenshot from 2020-08-27 19-36-09

Here's what I have :)

emil14 avatar Aug 27 '20 16:08 emil14

Hey there! Any progress?

create table if not exists users (
    id serial primary key,
    tg_chat_id integer unique check (tg_chat_id > 0)
);

create table if not exists assets (
    id serial primary key,
    name varchar(255) not null unique
);

create table if not exists accounts (
    id serial primary key,
    user_id integer references users(id),
    name varchar(255) not null,
    asset_id integer references assets(id),
    unique(user_id, name)
);

create table if not exists users_accounts (
    id serial primary key,
    user_id integer references users(id),
    account_id integer references accounts(id),
    unique(user_id, account_id)
);

Screenshot from 2023-06-30 10-15-18

  • SQLTools v0.28.0
  • SQLTools PostgreSQL/Cockroach Driver v0.5.1
  • OS: Ubuntu 22.04.2 LTS

emil14 avatar Jun 30 '23 07:06 emil14

I could fix this by myself but have no idea how this work. I know fullstack web dev thought. We can have zoom call and fix it together :)

emil14 avatar Jun 30 '23 07:06 emil14

:(

emil14 avatar Sep 06 '23 06:09 emil14