Maybe Solomon should not have asked for wisdom

I was looking back at the story of Solomon this morning. Why was asking for wisdom looked upon so wonderfully by the Lord? Was it just because he didn't ask for riches or long life --like it says? Or was it that the Lord really wanted him to ask for wisdom?

Also when I look back on the story, Solomon seemed to be granted a great deal of wisdom in all but the most important area. Why wasn't he wise enough to see that marrying foreign woman would lead him astray? He had to know, so maybe it was a willpower thing.

If given one wish from the Lord, I think I would request the willpower to follow after the Lord and be loyal to him and my family for the rest of my life. A relationship with the Lord that lasts would have kept Solomon's family on the throne forever. A relationship with the Lord that lasts would have the consequence of being a lasting friend of the Lord. This seems prize enough in itself.

As far as his wisdom goes, he made blunders such as working longer on his own palace than on the house of the Lord. Why? In God given wisdom why?

In retrospect, and with him as an example of wisdom, I think I would have preferred loyalty.