I was reading your question and thinking things along the line of the other posters: you're not suited to this job; give yourself a time limit; do something else for a moment. After some reflection, I'm not sure any of the answers are really that helpful
The trouble with mental issues like this is that they're not easy to solve, they're part of you, and obviously you care (too much perhaps) about your job, don't have the confidence to agree with yourself, are too inexperienced to consider you're first choice was right all along, or stress too much over getting it perfectly right. Why else would you worry over such trivialities?!
Now I have similar problems, but not with code so much.. usually its what to have for dinner.. pizza or curry.. hmm... pizza but then curry is nice, but do I feel like a curry, pizza is cheaper, but then you get more curry, but... and so on. :)
So I thought - why don't I have similar problems with coding, and I think its simply because I have a set of patterns that I use regularly. If I need a function definition, its easy.. it'll be in the same vein as every other function definition I've ever coded up. If I need a control flow, first I decide whether I need a for loop or a while loop and then create the same old code that I used last time I needed one of these things. The same goes for everything, do I want a queue? Sure - lets go cut and paste my 'standard' queue code (filched from the last project I worked on, or any one I can remember using one of these things). End result... I only fret over new stuff, and to be honest, that's a pleasure.
So, my advice is to start building a library of code snippets - I used to email them to myself and put them in a folder but whatever you work with is best - and then you will begin to know what to do every time. You'll always go to the old code you've written and get the problem out of the way, ready for the next problem. You'll find you become a much faster developer (seriously, this is the only way to gain programmer productivity) and hopefully will find time for the fun bits, not the dreary day-to-day stuff that you've already solved many times over.
Of course, the latter part of all that is important too - the more work you have, the less luxury you have to spend time thinking.