Assuming you’re using CI-based analysis: could you check the logs to confirm that indeed both files are being parsed and analyzed correctly? Are there any warnings? Would you mind sharing debug-level logs?
I observed some errors on parsing the sql file but that was expected. I checked the logs and there’s no errors when it came to the pgsql files. pgsql files are indexed as PostgreSQL, no issue on parsing, analyzing & Detection of duplications.
No sure how’s the LOC determined but I would be expecting LOC values closer to sql file copies.
I have a question regarding your files two and four: are they PostgreSQL function with a lot of code inside the $$ block? If so, does the number of lines of code reported in the Postgres analyzer match the number of lines of code outside the $$ block?
For your sample file, the behavior is unexpected since it was analyzed without a parsing error.
Could you send the .sql files? If they are sensitive, you could also send them to me privately.