pablintino / edaparts

Altium DBlib based main source files
MIT License
4 stars 1 forks source link

Altium "Part Number" concept review #18

Open reibax-marcus opened 2 days ago

reibax-marcus commented 2 days ago

I have noticed something that may be worth discussing about the Altium "Part Number" concept. It's kind of subtle, se let's see if I can do a good job of describing the situation.

If we look at how the data structures are defined, I believe this is the situation:

In the component table, we have the following constraint:

"_mpn_manufacturer_uc" UNIQUE CONSTRAINT, btree (mpn, manufacturer)

Which I believe to be 100% with real life: each manufacturer has its own part number naming scheme. Inside a manufacturer a MPN is believed to be unique, but although improbable, we cannot guarantee that will be universally unique.

It's not uncommon to see parts be bought by companies, so a specific part could exist with a given MPN in multiple manufacturers.

The problem comes when we have a look at the Altium * views, where we see this:

SELECT DISTINCT ON (c.id) c.mpn AS "Part Number",
...
RIGHT JOIN component c ON c.id = ct.cid

If I'm interpreting this correctly, what this means is that from the point of view of Altium components have a row called "Part Number" that are just a copy of the field MPN. My tests seem to match this statement.

This causes problems in Altium in cases where a specific MPN is found under two different manufacturers. What I end up having to do is manually alter the MPN field of the dubplicate parts, delete the dblib from Altium, and add it back after the conflicts have been manually fixed.

This could be solved by, for example, makeing "Part Number" = "Manufacturer_MPN".

Does all of this make any sense?

pablintino commented 2 days ago

HI @reibax-marcus, so I guess I got you, the problem as you describe is that you have part in your DB with the same MPN that is listed twice or more times inder different manufacturers? If so, yes, I think your proposal may be the best way to go, create a field that is the computation of manufacturer + MPN and use that one as the MPN field in Altium.