Québec is a province in Canada; it uses Civil Law rather than the British-style Common Law used in all other provinces.
In Québec there are restrictions both on first names and family names. A Québec "Educate me about the law" site summarizes the rules (https://educaloi.qc.ca/en/capsules/choosing-your-childs-name/). Why does Québec have rules like this - it uses the Civil Code; that code likes rules.
It's also worth noting that when you get married in Québec, the bride does not take the family name of the groom. This change happened at about the same time. When that change came in, an explicit rationale was given in the National Assembly (the provincial parliament). Québec has a strong Catholic heritage and divorce really wasn't a thing until about (um) the 1970s. The Directeur de l’état civil, under the Civil Code tracks all personal transactions (births, deaths, marriages, etc. - the LDS church loves Québec, genealogy is easy to track). Having women change their names multiple times during their lives made tracking this harder.
- “First names” includes middle names
- Your child cannot have more than four first names
- If one of the first names is a compound name (a name joined by a hyphen), you must insert a hyphen between the two names. If not, the two names will be considered two distinct names. (Note that compound first names are pretty common in Québec).
- The child can adopt either of the parents’ names, or a composite of the two names joined by a hyphen.
- When both parents have composite family names, you must choose a name that contains only two parts.
- A family name cannot include an initial (e.g.: B-Roy), because this kind of name does not meet the requirements of the Civil Code of Québec. The family names of the parents must be written in full so that the child’s family name fully reflects the family relationship to either of the parents, or both.
- Your newborn’s family name may differ from the family names of your other children. This means that children from the same parents can have different family names.
- The child’s family name cannot be composed of one of the parent’s first names.
Can the Directeur de l’état civil ask us to change the first or family names we give our child?
- Yes, and if you don't agree, you could end up in court
The change in the law that brought these rules into being happened the year my wife and I were married. This was way before the internet. I went to the courthouse (or maybe some other official building) to get information about the new law. There weren't even pamphlets printed up (the law was in its infancy). I asked the clerk if I could get something to bring home and read with my fiancée (since it changed a bunch of stuff about marriage law, and we were about to get married).
He gave me a quick rundown of stuff I already knew from reading the newspapers. Then, being in the software business and trained to look at edge cases, I asked about that second to the last point (about children having different family names). He hadn't brought that up. I gave my example: Say we have 4 boys, can we name them all Robert - can we give them four different family names:
- Robert Fly
- Robert Dog
- Robert Fly-Dog
- Robert Dog-Fly
He looked me in the eye, cursed, said something like "What, are you some kind of idiot" and then "Next", shooing me out of the line.
Note: I don't see how to tag this answer with a locale
Also Note: Much of this content is taken (either via summary or verbatim) from the linked site. That site does have a (c) notice, but the terms of service do not elaborate on any licensing restrictions.