  We ask whether every polynomial function that is non-negative on a real
algebraic curve can be expressed as a sum of squares in the coordinate ring.
Scheiderer has classified all irreducible curves for which this is the case.
For reducible curves, we show how the answer depends on the configuration of
the irreducible components and give complete necessary and sufficient
conditions. We also prove partial results in the more general case of finitely
generated preorderings and discuss applications to the moment problem for
semialgebraic sets.
