pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Perry Smith <pedz@easesoftware.com>
To: pgsql-general list <pgsql-general@lists.postgresql.org>
Subject: Re: Oddity that I don't understand
Date: Thu, 11 Aug 2022 08:28:30 -0500
Message-ID: <63C9E87C-5784-463D-9DB3-2F3954457690@easesoftware.com> (raw )
In-Reply-To: <97EC2704-FA5A-4217-B8CD-67294D0FA664@easesoftware.com >
References: <97EC2704-FA5A-4217-B8CD-67294D0FA664@easesoftware.com >
I see why… The select of the view is picking d.ino which is null because there is no match in the dirents table.
Thanks guys!
> On Aug 11, 2022, at 08:23, Perry Smith <pedz@easesoftware.com> wrote:
>
> I’m tempted to ask “Is this a bug” but I predict there is an explanation.
>
> I have a view:
> find_dups=# \sv+ dateien
> 1 CREATE OR REPLACE VIEW public.dateien AS
> 2 SELECT d.id <http://d.id/ ;,
> 3 d.basename,
> 4 d.parent_id,
> 5 d.ino,
> 6 d.ext,
> 7 i.ftype,
> 8 i.uid,
> 9 i.gid,
> 10 i.mode,
> 11 i.mtime,
> 12 i.nlink,
> 13 i.size,
> 14 i.sha1,
> 15 i.file_type
> 16 FROM dirents d
> 17 FULL JOIN inodes i USING (ino)
>
> find_dups=# \d inodes
> Table "public.inodes"
> Column | Type | Collation | Nullable | Default
> ------------+--------------------------------+-----------+----------+---------
> ino | bigint | | not null |
> ftype | character varying | | not null |
> uid | bigint | | not null |
> gid | bigint | | not null |
> mode | bigint | | not null |
> mtime | timestamp without time zone | | not null |
> nlink | bigint | | not null |
> size | bigint | | not null |
> sha1 | character varying | | |
> created_at | timestamp(6) without time zone | | not null |
> updated_at | timestamp(6) without time zone | | not null |
> file_type | character varying | | |
> Indexes:
> "inodes_pkey" PRIMARY KEY, btree (ino)
> "index_inodes_on_ftype_and_size_and_file_type_and_sha1_and_nlink" btree (ftype, size, file_type, sha1, nlink)
> Referenced by:
> TABLE "dirents" CONSTRAINT "fk_rails_f076303053" FOREIGN KEY (ino) REFERENCES inodes(ino)
>
> find_dups=# \d dirents
> Table "public.dirents"
> Column | Type | Collation | Nullable | Default
> ------------+--------------------------------+-----------+----------+-------------------------------------
> id | bigint | | not null | nextval('dirents_id_seq'::regclass)
> basename | character varying | | not null |
> parent_id | bigint | | |
> ino | bigint | | not null |
> created_at | timestamp(6) without time zone | | not null |
> updated_at | timestamp(6) without time zone | | not null |
> ext | character varying | | |
> Indexes:
> "dirents_pkey" PRIMARY KEY, btree (id)
> "index_dirents_on_basename" btree (basename)
> "index_dirents_on_ext" btree (ext)
> "index_dirents_on_ino" btree (ino)
> "index_dirents_on_parent_id_and_basename" UNIQUE, btree (parent_id, basename)
> Foreign-key constraints:
> "fk_rails_4dfefe0fc0" FOREIGN KEY (parent_id) REFERENCES dirents(id) ON DELETE CASCADE
> "fk_rails_f076303053" FOREIGN KEY (ino) REFERENCES inodes(ino)
> Referenced by:
> TABLE "dirents" CONSTRAINT "fk_rails_4dfefe0fc0" FOREIGN KEY (parent_id) REFERENCES dirents(id) ON DELETE CASCADE
>
> I do a select and I get:
>
> find_dups=# select id, basename, ext, parent_id, ino, sha1 from dateien where sha1 = '36f53d60353e0de6ed55d9da70a36b17559039f3' order by parent_id;
> id | basename | ext | parent_id | ino | sha1
> ----------+--------------+-----+-----------+----------+------------------------------------------
> 85276821 | VC5Y8191.CR2 | CR2 | 85273064 | 70163023 | 36f53d60353e0de6ed55d9da70a36b17559039f3
> 85829158 | VC5Y8191.CR2 | CR2 | 85827904 | 79366 | 36f53d60353e0de6ed55d9da70a36b17559039f3
> | | | | | 36f53d60353e0de6ed55d9da70a36b17559039f3
> (3 rows)
>
> How can the third line exist? Or, perhaps I should ask, what is the third line telling me?
>
> Thank you,
> Perry
>
>
>
Attachments:
signature.asc (application/pgp-signature, 832B) download
view thread (2+ messages)
Message-ID: <63C9E87C-5784-463D-9DB3-2F3954457690@easesoftware.com>
Permalink: ../63C9E87C-5784-463D-9DB3-2F3954457690@easesoftware.com/
Also on: postgresql.org/message-id/63C9E87C-5784-463D-9DB3-2F3954457690@easesoftware.com
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: pedz@easesoftware.com
Subject: Re: Oddity that I don't understand
In-Reply-To: <63C9E87C-5784-463D-9DB3-2F3954457690@easesoftware.com>
References: <97EC2704-FA5A-4217-B8CD-67294D0FA664@easesoftware.com> <63C9E87C-5784-463D-9DB3-2F3954457690@easesoftware.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox