Male/female

Started by Raymond O'Donnellover 19 years ago39 messagesgeneral
Jump to latest

Just wondering.....how do list member represent gender when storing
details of people in a database?

I've done it two ways:

* A bool column, with the understanding that true/false represents
one gender or the other.

* Create a domain, something like:
CREATE DOMAIN gender_domain
AS character varying(7)
NOT NULL
CONSTRAINT gender_domain_check CHECK ((((VALUE)::text =
'male'::text) OR ((VALUE)::text = 'Female'::text)))

I personally prefer the second, as it's self-documenting...is there
any other/better way of doing it?

--Ray.

----------------------------------------------------------------------

Raymond O'Donnell
Director of Music, Galway Cathedral, Galway, Ireland
rod@iol.ie
----------------------------------------------------------------------

#2John Meyer
john.l.meyer@gmail.com
In reply to: Raymond O'Donnell (#1)
Re: Male/female

Second method might be better.

Of course, you could also do a one chracter gender "M/F" if you want to
save space.

Raymond O'Donnell wrote:

Show quoted text

Just wondering.....how do list member represent gender when storing
details of people in a database?

I've done it two ways:

* A bool column, with the understanding that true/false represents
one gender or the other.

* Create a domain, something like:
CREATE DOMAIN gender_domain
AS character varying(7)
NOT NULL
CONSTRAINT gender_domain_check CHECK ((((VALUE)::text =
'male'::text) OR ((VALUE)::text = 'Female'::text)))

I personally prefer the second, as it's self-documenting...is there
any other/better way of doing it?

--Ray.

----------------------------------------------------------------------

Raymond O'Donnell
Director of Music, Galway Cathedral, Galway, Ireland
rod@iol.ie
----------------------------------------------------------------------

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

#3Ron Johnson
ron.l.johnson@cox.net
In reply to: Raymond O'Donnell (#1)
Re: Male/female

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/08/06 09:23, Raymond O'Donnell wrote:

Just wondering.....how do list member represent gender when storing
details of people in a database?

I've done it two ways:

* A bool column, with the understanding that true/false represents
one gender or the other.

* Create a domain, something like:
CREATE DOMAIN gender_domain
AS character varying(7)
NOT NULL
CONSTRAINT gender_domain_check CHECK ((((VALUE)::text =
'male'::text) OR ((VALUE)::text = 'Female'::text)))

I personally prefer the second, as it's self-documenting...is there
any other/better way of doing it?

I've only ever seen a CHAR(1) restricted to 'M'/'F'.

- --
Ron Johnson, Jr.
Jefferson LA USA

Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFeYXkS9HxQb37XmcRAtoeAKCmupJdzyH7MzEqfmWGI9lPtM6MfwCg13X6
wdPnXc1DrLN+8oKPSusVk0g=
=5Xwk
-----END PGP SIGNATURE-----

#4Andreas Kretschmer
akretschmer@spamfence.net
In reply to: Raymond O'Donnell (#1)
Re: Male/female

Raymond O'Donnell <rod@iol.ie> schrieb:

Just wondering.....how do list member represent gender when storing
details of people in a database?

I've done it two ways:

* A bool column, with the understanding that true/false represents
one gender or the other.

* Create a domain, something like:
CREATE DOMAIN gender_domain
AS character varying(7)
NOT NULL
CONSTRAINT gender_domain_check CHECK ((((VALUE)::text =
'male'::text) OR ((VALUE)::text = 'Female'::text)))

What about with Hermaphroditism?

SCNR.

Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknow)
Kaufbach, Saxony, Germany, Europe. N 51.05082�, E 13.56889�

#5Berend Tober
btober@seaworthysys.com
In reply to: Raymond O'Donnell (#1)
Re: Male/female

Raymond O'Donnell wrote:

Just wondering.....how do list member represent gender when storing
details of people in a database?

I've done it two ways:

* A bool column, with the understanding that true/false represents
one gender or the other.

* Create a domain, something like:
CREATE DOMAIN gender_domain
AS character varying(7)
NOT NULL
CONSTRAINT gender_domain_check CHECK ((((VALUE)::text =
'male'::text) OR ((VALUE)::text = 'Female'::text)))

I personally prefer the second, as it's self-documenting...is there
any other/better way of doing it?

--
-- PostgreSQL database dump
--

CREATE TABLE gender (
gender_pk SERIAL,
gender character varying(9) NOT NULL
);

COMMENT ON TABLE gender IS 'This table defines currently valid gender
types (and allows for god knows what..).';

COPY gender (gender_pk, gender) FROM stdin;
0 (unknown)
1 Male
2 Female
3 Trans
\.

ALTER TABLE ONLY gender ADD CONSTRAINT gender_pkey PRIMARY KEY (gender_pk);

#6Leif B. Kristensen
leif@solumslekt.org
In reply to: Raymond O'Donnell (#1)
Re: Male/female

On Friday 8. December 2006 16:23, Raymond O'Donnell wrote:

Just wondering.....how do list member represent gender when storing
details of people in a database?

I've done it two ways:

* A bool column, with the understanding that true/false represents
one gender or the other.

* Create a domain, something like:
CREATE DOMAIN gender_domain
AS character varying(7)
NOT NULL
CONSTRAINT gender_domain_check CHECK ((((VALUE)::text =
'male'::text) OR ((VALUE)::text = 'Female'::text)))

I personally prefer the second, as it's self-documenting...is there
any other/better way of doing it?

There's actually an ISO standard (ISO 5218) for representing gender with
numeric values: 0 = Unknown, 1 = Male, 2 = Female, 9 = not specified
(or N/A).
--
Leif Biberg Kristensen | Registered Linux User #338009
http://solumslekt.org/ | Cruising with Gentoo/KDE

#7Steve Wampler
swampler@noao.edu
In reply to: Andreas Kretschmer (#4)
Re: Male/female

Andreas Kretschmer wrote:

What about with Hermaphroditism?

More seriously - is the gender something you always know? There
are situations in the US where you cannot force someone to divulge
their gender. So you may need an 'unreported' value of some sort.

--
Steve Wampler -- swampler@noao.edu
The gods that smiled on your birth are now laughing out loud.

#8John Meyer
john.l.meyer@gmail.com
In reply to: Berend Tober (#5)
Re: Male/female

COPY gender (gender_pk, gender) FROM stdin;
0 (unknown)
1 Male
2 Female
3 Trans
\.

Not to take this completely off track, but isn't transgendered not so
much a gender as it is a process of moving from one gender to another?

#9David Fetter
david@fetter.org
In reply to: Raymond O'Donnell (#1)
Re: Male/female

On Fri, Dec 08, 2006 at 03:23:11PM -0000, Raymond O'Donnell wrote:

Just wondering.....how do list member represent gender when storing
details of people in a database?

I usually use a table called gender which has one TEXT column, that
being its primary key. For one client I had, there were seven rows in
this table.

Cheers,
D
--
David Fetter <david@fetter.org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter

Remember to vote!

#10John Meyer
john.l.meyer@gmail.com
In reply to: David Fetter (#9)
Re: Male/female

Seven genders? Even San Fransisco thinks that's over the top.
David Fetter wrote:

Show quoted text

On Fri, Dec 08, 2006 at 03:23:11PM -0000, Raymond O'Donnell wrote:

Just wondering.....how do list member represent gender when storing
details of people in a database?

I usually use a table called gender which has one TEXT column, that
being its primary key. For one client I had, there were seven rows in
this table.

Cheers,
D

#11Joshua D. Drake
jd@commandprompt.com
In reply to: John Meyer (#8)
Re: Male/female

On Fri, 2006-12-08 at 09:31 -0700, John Meyer wrote:

COPY gender (gender_pk, gender) FROM stdin;
0 (unknown)
1 Male
2 Female
3 Trans
\.

Not to take this completely off track, but isn't transgendered not so
much a gender as it is a process of moving from one gender to another?

Yes, but further I don't know of any country that recognizes anything
but Male or Female.

Joshua D. Drake

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate

#12Jorge Godoy
jgodoy@gmail.com
In reply to: Joshua D. Drake (#11)
Re: Male/female

"Joshua D. Drake" <jd@commandprompt.com> writes:

Yes, but further I don't know of any country that recognizes anything
but Male or Female.

I haven't read the beginning of the thread, but will this table be used only
for humans? There are animals that are hermafrodites (I hope I got the
English correct...) or whose sex is only identifiable after a period of time
(days or months, usually).

So, for researchers it would be interesting to have more options.

Also, if you're doing statistics on something where the sexual option (and
transgerderness) is important, then there should be some way to point that.

--
Jorge Godoy <jgodoy@gmail.com>

#13Scott Marlowe
smarlowe@g2switchworks.com
In reply to: John Meyer (#10)
Re: Male/female

On Fri, 2006-12-08 at 10:44, John Meyer wrote:

David Fetter wrote:

On Fri, Dec 08, 2006 at 03:23:11PM -0000, Raymond O'Donnell wrote:

Just wondering.....how do list member represent gender when storing
details of people in a database?

I usually use a table called gender which has one TEXT column, that
being its primary key. For one client I had, there were seven rows in
this table.

Seven genders? Even San Fransisco thinks that's over the top.

Let's see.

Male
Female
Hermaphrodite
Trans (MTF)
Trans (FTM)
Neuter

and... I can't think of a seventh possibility.

#14Scott Marlowe
smarlowe@g2switchworks.com
In reply to: Joshua D. Drake (#11)
Re: Male/female

On Fri, 2006-12-08 at 11:05, Joshua D. Drake wrote:

On Fri, 2006-12-08 at 09:31 -0700, John Meyer wrote:

COPY gender (gender_pk, gender) FROM stdin;
0 (unknown)
1 Male
2 Female
3 Trans
\.

Not to take this completely off track, but isn't transgendered not so
much a gender as it is a process of moving from one gender to another?

Yes, but further I don't know of any country that recognizes anything
but Male or Female.

In thailand, there are highschools with bathrooms for the transgendered
MTF girls. Not sure if the country itself recognized MTF trans as a
gender or not though.

#15Berend Tober
btober@seaworthysys.com
In reply to: Joshua D. Drake (#11)
Re: Male/female

Joshua D. Drake wrote:

On Fri, 2006-12-08 at 09:31 -0700, John Meyer wrote:

COPY gender (gender_pk, gender) FROM stdin;
0 (unknown)
1 Male
2 Female
3 Trans
\.

Not to take this completely off track, but isn't transgendered not so
much a gender as it is a process of moving from one gender to another?

Yes, but further I don't know of any country that recognizes anything
but Male or Female.

... Yet.

#16Berend Tober
btober@seaworthysys.com
In reply to: Scott Marlowe (#13)
Re: Male/female

Scott Marlowe wrote:

On Fri, 2006-12-08 at 10:44, John Meyer wrote:

David Fetter wrote:

On Fri, Dec 08, 2006 at 03:23:11PM -0000, Raymond O'Donnell wrote:

Just wondering.....how do list member represent gender when storing
details of people in a database?

I usually use a table called gender which has one TEXT column, that
being its primary key. For one client I had, there were seven rows in
this table.

Seven genders? Even San Fransisco thinks that's over the top.

Let's see.

Male
Female
Hermaphrodite
Trans (MTF)
Trans (FTM)
Neuter

and... I can't think of a seventh possibility.

"Unspecified"

#17brian
brian@zijn-digital.com
In reply to: Scott Marlowe (#13)
Re: Male/female

Scott Marlowe wrote:

On Fri, 2006-12-08 at 10:44, John Meyer wrote:

David Fetter wrote:

On Fri, Dec 08, 2006 at 03:23:11PM -0000, Raymond O'Donnell wrote:

Just wondering.....how do list member represent gender when storing
details of people in a database?

I usually use a table called gender which has one TEXT column, that
being its primary key. For one client I had, there were seven rows in
this table.

Seven genders? Even San Fransisco thinks that's over the top.

Let's see.

Male
Female
Hermaphrodite
Trans (MTF)
Trans (FTM)
Neuter

and... I can't think of a seventh possibility.

As has been pointed out, some governments forbid the collection of
gender information, so the seventh would be unknown/unreported.

brian

#18Madison Kelly
linux@alteeve.com
In reply to: Jorge Godoy (#12)
Re: Male/female

Jorge Godoy wrote:

"Joshua D. Drake" <jd@commandprompt.com> writes:

Yes, but further I don't know of any country that recognizes anything
but Male or Female.

I haven't read the beginning of the thread, but will this table be used only
for humans? There are animals that are hermafrodites (I hope I got the
English correct...) or whose sex is only identifiable after a period of time
(days or months, usually).

So, for researchers it would be interesting to have more options.

Also, if you're doing statistics on something where the sexual option (and
transgerderness) is important, then there should be some way to point that.

Some people argue that gender is a spectrum. If you want to be very
inclusive. Maybe you could use a 'float' and stick with 0 = woman, 1 =
man (self documenting after all) with the option of '0.1 - 0.9' for
people who feel "in between". How efficient is 'float'? This would also
work for animals that fall outside then normal male/female designation.

Madi

#19John Meyer
john.l.meyer@gmail.com
In reply to: Madison Kelly (#18)
Re: Male/female

I guess in the end it really depends on what the client wants to track
and what they don't. But this does actually have a serious implication,
and that is how do you code for something that is mutable vs. something
that supposedly is or very nearly immutable (i.e. the alphabet).

#20Brian J. Erickson
ericksbr@infocon-inc.com
In reply to: Raymond O'Donnell (#1)
Re: Male/female

That not including Genetics,
where and individual could have
multiple X Chromomes individuals
Or be XY - female times those other
6 (or 7).

----- Original Message -----
From: "brian" <brian@zijn-digital.com>
To: <pgsql-general@postgresql.org>
Sent: Friday, December 08, 2006 9:19 AM
Subject: Re: [GENERAL] Male/female

Show quoted text

Scott Marlowe wrote:

On Fri, 2006-12-08 at 10:44, John Meyer wrote:

David Fetter wrote:

On Fri, Dec 08, 2006 at 03:23:11PM -0000, Raymond O'Donnell wrote:

Just wondering.....how do list member represent gender when storing
details of people in a database?

I usually use a table called gender which has one TEXT column, that
being its primary key. For one client I had, there were seven rows in
this table.

Seven genders? Even San Fransisco thinks that's over the top.

Let's see.

Male
Female
Hermaphrodite
Trans (MTF)
Trans (FTM)
Neuter

and... I can't think of a seventh possibility.

As has been pointed out, some governments forbid the collection of
gender information, so the seventh would be unknown/unreported.

brian

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

#21Steve Crawford
scrawford@pinpointresearch.com
In reply to: Scott Marlowe (#13)
#22Ron Johnson
ron.l.johnson@cox.net
In reply to: John Meyer (#2)
#23Ron Johnson
ron.l.johnson@cox.net
In reply to: Leif B. Kristensen (#6)
#24David Fetter
david@fetter.org
In reply to: Scott Marlowe (#13)
In reply to: Jorge Godoy (#12)
In reply to: Scott Marlowe (#13)
#27Ben
bench@silentmedia.com
In reply to: Steve Wampler (#7)
In reply to: Raymond O'Donnell (#25)
#29Richard Troy
rtroy@ScienceTools.com
In reply to: Raymond O'Donnell (#25)
#30Merlin Moncure
mmoncure@gmail.com
In reply to: Joshua D. Drake (#11)
#31John D. Burger
john@mitre.org
In reply to: Steve Crawford (#21)
#32Richard Troy
rtroy@ScienceTools.com
In reply to: David Fetter (#24)
#33Steve Crawford
scrawford@pinpointresearch.com
In reply to: Richard Troy (#29)
#34Oisin Glynn
me@oisinglynn.com
In reply to: Steve Crawford (#33)
#35Ron Johnson
ron.l.johnson@cox.net
In reply to: Richard Troy (#32)
#36David Fetter
david@fetter.org
In reply to: Ron Johnson (#35)
#37A.M.
agentm@themactionfaction.com
In reply to: Oisin Glynn (#34)
#38Jorge Godoy
jgodoy@gmail.com
In reply to: Madison Kelly (#18)
#39Michael Nolan
htfoot@gmail.com
In reply to: Jorge Godoy (#38)