So if is ok for a judge to make a bad ruling and subsequent judges to use that bad ruling to make future bad rulings? or is the judge obligated to only consider the constitution and ignore those past bad rulings?
Nobody taught us in school about the great power of case law that apparently has more power than the words of the constitution.
That depends on jurisdiction ... I believe the Federal system is common in the USA ...
Federal District Court is the entry point for most any case ... and here you are correct, the judge will follow precedent, meaning he/she will rule as other judges have before ... you used the term "case law" and another term is "common law" ...
If this is a truly bad precedent, and you thing your case will show this clearly ... the you APPEAL the District Courts ruling at the Appellant Court, there are thirteen different appellant courts in the USA ... here is where a precedent can be challenged ... It's rare but sometimes even the SCOTUS may have to weigh in ...
And FINALLY ... 2/3's of each House of Congress and 3/4's of the States overrules the SCOTUS ... 18-year-old suffrage is a good example ...
en.wikipedia.org