Category “YeSQL” — 77 articles

Finding orphaned sequences

This time we’re having a database where sequences were used, but not systematically as a default value of a given column. It’s mainly an historic bad idea, but you know the usual excuse with bad ideas and bad code: the first 6 months it’s experimental, after that it’s historic. *Not talking about genome orphaned sequences here, though* Still, here’s a query for 8.4 that will allow you to list those sequences you have that are not used as a default value in any of your tables:



The problem was raised this week on IRC and this time again I felt it would be a good occasion for a blog entry: how to load an XML file content into a single field? The usual tool used to import files is COPY, but it’ll want each line of the file to host a text representation of a database tuple, so it doesn’t apply to the case at hand. RhodiumToad was online and offered the following code to solve the problem:

Dimitri Fontaine

PostgreSQL Major Contributor

Open Source Software Engineer

France