I do not exactly know how it works with Pentax (I'am a Canon shooter) but I expect it will be the same.
A Canon camera knows only about Canon lenses. It detect the lens by the so called LensID and write the correct metadata into the EXIF data the image. If you use a third party lens, the Camera does not know which a the correct values to write into the EXIF data. Thrid party lens vendors typicaly use a valid LensID of some (old) Canon lenses to solve this problem. But: Focal lenght and LensID rearly match.
Third party software must know which LensID and focal lens are used for a third party Lens. Often, there are multiple lenses possible. You can find out more about your metadata using a software called exiftool, which has a very log list of Pentax / Lens combinations.
To make the story short: Third party software must make a guess, an LR makes the wrong one. (You can use exiftool to fill in the correct metadata into your images, LensMake, LensModel, if you like.)
Thanks for answer THG_BO
In my case the Silky Pix software shippng with Pentax detects everything OK, even so does exiftool which I've used i my own developed software.
Lightroom destroys the exifdata when exported to jpg and my software reads 70-200 instead of 150-500.
It's a litlle annoying if you like to show all images done with a certain lens.
Perhaps nothing to do about
I just hoped that it was possible to learn Lightroom which lens it actually is.
yes, LR destroys some exif data (e.g. makernotes). You might use exiftool to write back the missing meta data if you like. Here is an example I already used:
exiftool -if "$LensType eq 8" -if "$LensMake ne Sigma" -LensMake="Sigma" -LensModel="Sigma 70-300mm f/4-5.6 [APO] DG Macro" -Lens="Sigma 70-300mm f/4-5.6 [APO] DG Macro" -lensInfo="70 300 4 22" -n -r -overwrite_original *.jpg
The -if part checks if the image was taken with this lens and may differ in your case.
I will try your script.