בָּנָה בַיִת חָדָשׁ, וְקָנָה כֵלִים חֲדָשִׁים, אוֹמֵר בָּרוּךְ שֶׁהֶחֱיָנוּ. מְבָרֵךְ עַל הָרָעָה מֵעֵין הַטּוֹבָה, וְעַל הַטּוֹבָה מֵעֵין הָרָעָה. הַצּוֹעֵק לְשֶׁעָבַר, הֲרֵי זוֹ תְּפִלַּת שָׁוְא. כֵּיצַד. הָיְתָה אִשְׁתּוֹ מְעֻבֶּרֶת, וְאָמַר, יְהִי רָצוֹן שֶׁתֵּלֵד אִשְׁתִּי זָכָר, הֲרֵי זוֹ תְּפִלַּת שָׁוְא. הָיָה בָא בַדֶּרֶךְ וְשָׁמַע קוֹל צְוָחָה בָּעִיר, וְאָמַר יְהִי רָצוֹן שֶׁלֹּא יִהְיוּ אֵלּוּ בְּנֵי בֵיתִי, הֲרֵי זוֹ תְּפִלַּת שָׁוְא:
If he built a new house or bought new vessels, he says "shehecheyanu" ("who kept us in life, etc.") [Whether or not he has other vessels of the same kind, he says "shehecheyanu."] One blesses over an evil in which good inheres [The gemara explains: as when one's fields are flooded and he loses this year's crop. Though the soil is saturated and the field made more fertile for the years to come, now, however, it is evil, and he blesses "dayan ha'emeth"], and over a good in which an evil inheres [as when one finds a lost object. Even though it is evil for him, for if the king hears of it, he will be beaten and tortured and the object taken from him, now, however, it is good, and he blesses "hatov vehametiv"]. Crying out over what is past constitutes a vain prayer. [If one prays for what has already taken place, this is a vain prayer, for "what has been has been"], as in one's praying: "May it be Your will that my wife bear a son," when she is already pregnant; or, as in one's returning from a journey and hearing wailing within the city, praying: "May it be Your will that it not be coming from my house."
Bereshit Rabbah
“Leah said: God has granted me a fine gift; now my husband will reside with me, because I bore him six sons. She called his name Zebulun” (Genesis 30:20).
“Leah said: God has granted me a fine gift” – this field, as long as you fertilize it and hoe it, it produces produce.
“Then she bore a daughter, and she called her name Dina” (Genesis 30:21).
“Then she bore a daughter” – it is taught:12This is a baraita. How so? One whose wife was pregnant, and he says: ‘May it be God’s will that my wife will give birth to a male,’ it is a vain prayer. The school of Rabbi Yanai said: This baraita is when she is sitting on the travailing chair. Rabbi Yehuda ben Pazi said: Even for one sitting on the travailing chair, it can change. That is what is written: “House of Israel, can I not do to you like this potter? [The utterance of the Lord]. Behold, like the clay in the hand of the potter, so you are in My hand, house of Israel” (Jeremiah 18:6). Just as this potter, who formed the jug, breaks it and crafts another, I, too, can do so, even on the travailing chair.
He13Rabbi Yehuda ben Pazi. raised an objection: But is it not written: “Then she bore a daughter”?14Only at the birth it was a daughter, but not before. He said to him: Its primary creation was male, but due to Rachel’s prayer: “May the Lord add another son for me” (Genesis 30:24) – it became a female.15At an early stage in the pregnancy.
Rabbi Ḥanina ben Pazi said: The matriarchs were prophets, and Rachel was one of the matriarchs. “May the Lord add other sons for me” is not written here, but rather, “another son.” She said: ‘He is destined to produce one more; if only it will be from me.’
Rabbi Ḥanina said: All the matriarchs gathered and said: ‘We have enough [dayenu]16This is expounded from the name Dina. The letters of Dina are: dalet, yod, nun, heh. The letter of dayenu are dalet, yod, nun, vav. males. Remember this one again.’