[SQL] need asap: bg_BG locale for FreeBSD
Hi, I'm going to Bulgaria this week to setup FreeBSD server running postgres and would like to know if somebody has an experience with postgres and bulgarian locale. Actually, I need bg_BG locale for FreeBSD. interesting that searching for subject in internet doesn't provide any information. The only thing I found is bg_BG locale for Linux (Redhat) Regards, Oleg _ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83
[SQL] making two columns out of one
I've got a table containing some timesheet data.
Fields are emp, earncode, lo_shift, hi_shift.
SELECT emp, sum(hi_shift - lo_shift) as reghrs from timesheet
where earncode in ('R', 'C', 'X') order by emp
will give me all the regular hours
SELECT emp, sum(hi_shift - lo_shift) as ovrhrs from timesheet
where earncode not in ('R', 'C', 'X') order by emp
will give me all the overtime hours.
How do I combine these to get one result set with emp, reghrs, ovrhrs on
each row.
Frank
1stUp.com - Free the Web
Get your free Internet access at http://www.1stUp.com
Re: [SQL] need asap: bg_BG locale for FreeBSD
Oleg Bartunov wrote: > > Hi, > > I'm going to Bulgaria this week to setup FreeBSD server running > postgres and would like to know if somebody has an experience > with postgres and bulgarian locale. Actually, I need > bg_BG locale for FreeBSD. interesting that searching for > subject in internet doesn't provide any information. > The only thing I found is bg_BG locale for Linux (Redhat) I created a Swedish LC_COLLATE locale part for FreeBSD a while back, with the specific purpose of using it with PostgreSQL, and it was not very hard. For sorting stuff: Check /usr/src/share/colldef (the sorting algoritm is defined by LC_COLLATE). I don't anything about bulgarian, though. Is it using cyrillic characters? Try using one of the russion locales to start with. For character representation (LC_CTYPE), I have no experience, but it should also be fairly easy. Maybe Bulgarian uses a similar character set to for example Russian? You will only need a character locale for each Check /usr/src/share/mklocale For a complete locale, you would also need timedef (/usr/src/share/timedef). colldef(1) is man page to check for sorting (collate)... mklocale(1) is for locale creation. Good luck! Palle
[SQL] Tree structure
Title: Tree structure Anybody know how to make a tree structure using related tables using Postgres. Something like a directory structure is what I'm aiming for. I'm sure there is an easy way but I'm having probs. Any help would be appreciated. Ben.
Re: [SQL] need asap: bg_BG locale for FreeBSD
Palle, thanks for the message. I've created bulgarian locale from similar russian sources (I believe it's CP1251 charset). Hope it would be ok. Regards, Oleg On Mon, 11 Sep 2000, Palle Girgensohn wrote: > Date: Mon, 11 Sep 2000 15:51:23 +0200 > From: Palle Girgensohn <[EMAIL PROTECTED]> > To: Oleg Bartunov <[EMAIL PROTECTED]> > Cc: [EMAIL PROTECTED], [EMAIL PROTECTED] > Subject: Re: [SQL] need asap: bg_BG locale for FreeBSD > > Oleg Bartunov wrote: > > > > Hi, > > > > I'm going to Bulgaria this week to setup FreeBSD server running > > postgres and would like to know if somebody has an experience > > with postgres and bulgarian locale. Actually, I need > > bg_BG locale for FreeBSD. interesting that searching for > > subject in internet doesn't provide any information. > > The only thing I found is bg_BG locale for Linux (Redhat) > > I created a Swedish LC_COLLATE locale part for FreeBSD a while > back, with the specific purpose of using it with PostgreSQL, > and it was not very hard. > > For sorting stuff: > Check /usr/src/share/colldef (the sorting algoritm is defined > by LC_COLLATE). I don't anything about bulgarian, though. Is it > using cyrillic characters? Try using one of the russion locales > to start with. > > For character representation (LC_CTYPE), I have no experience, > but it should also be fairly easy. Maybe Bulgarian uses a > similar character set to for example Russian? You will only > need a character locale for each Check /usr/src/share/mklocale > > For a complete locale, you would also need timedef > (/usr/src/share/timedef). > > colldef(1) is man page to check for sorting (collate)... > > mklocale(1) is for locale creation. > > Good luck! > Palle > _ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83
Re: [SQL] Isolation and Concurrency in PG functions?
Roberto Mello <[EMAIL PROTECTED]> writes: > I am porting some VERY big functions to PG for a data warehousing system > (that is GPL'd BTW) and it seems that the results of one portion of the > function (e.g. a create table or a series of inserts) are invisible to > the other parts which obviously causes the function (and following > functions) to fail and is completely driving me nuts because I see the > results when I do the queries interactively. ?? How are you defining these functions, exactly? In SQL or PLPGSQL functions, successive queries certainly do see each others' results, for example regression=# create table foot (f1 int); CREATE regression=# create function foo(int) returns int as regression-# 'insert into foot values($1); regression'# select count(*) from foot' language 'sql'; CREATE regression=# select foo(1); foo - 1 (1 row) regression=# select foo(1); foo - 2 (1 row) If you are coding at the C level you may need to call CommandCounterIncrement() between queries. regards, tom lane
Re: [SQL] Tree structure
Normally it's done with self-relation. You need a table with "ID" and "PARENT_ID". PARENT_ID will contain null for root level and other row's ID for children. One warning: going through such tree could be slow. I don't know is there anything PostgreSQL specific that might help. I know that Oracle have a special tree command. At 14:27 11.9.2000 , Trewern, Ben wrote: Anybody know how to make a tree structure using related tables using Postgres. Something like a directory structure is what I'm aiming for. I'm sure there is an easy way but I'm having probs. Any help would be appreciated. Ben.
[SQL] How can I select all of the tables with field name 'area'?
I have a database with several tables. I'd like to pull out a list of names for the tables that contain the field (class) name 'area'. Can this be done? -Tony
RE: [SQL] How can I select all of the tables with field name 'area'?
You should be able to query the system table that holds that column names. Not sure which it is tho. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of G. Anthony Reina Sent: Monday, September 11, 2000 4:38 PM To: [EMAIL PROTECTED] Subject: [SQL] How can I select all of the tables with field name 'area'? I have a database with several tables. I'd like to pull out a list of names for the tables that contain the field (class) name 'area'. Can this be done? -Tony
Re: [SQL] How can I select all of the tables with field name 'area'?
Here's what you are looking for: SELECT pg_class.relname FROM pg_class, pg_attribute WHERE pg_attribute.attname = 'area' AND pg_attribute.attrelid = pg_class.oid; This should give you all of the classes (tables) which have the attribute (field) 'area'. Cheers, Darrin -Original Message- From: Stuart Foster <[EMAIL PROTECTED]> To: G. Anthony Reina <[EMAIL PROTECTED]>; [EMAIL PROTECTED] <[EMAIL PROTECTED]> Date: Monday, September 11, 2000 7:03 PM Subject: RE: [SQL] How can I select all of the tables with field name 'area'? >You should be able to query the system table that holds that column names. >Not sure which it is tho. > >-Original Message- >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf >Of G. Anthony Reina >Sent: Monday, September 11, 2000 4:38 PM >To: [EMAIL PROTECTED] >Subject: [SQL] How can I select all of the tables with field name >'area'? > > >I have a database with several tables. I'd like to pull out a list of >names for the tables that contain the field (class) name 'area'. > >Can this be done? > >-Tony > > >
Re: [SQL] How can I select all of the tables with field name 'area'?
Thanks Darrin and Stuart. -Tony Darrin Ladd wrote: > Here's what you are looking for: > > SELECT pg_class.relname > FROM pg_class, pg_attribute > WHERE pg_attribute.attname = 'area' > AND pg_attribute.attrelid = pg_class.oid; > > This should give you all of the classes (tables) which have the attribute > (field) 'area'. > >
Re: [SQL] Re: [BUGS] "ORDER BY" issue - is this a bug?
On Mon, 11 Sep 2000, Lamar Owen wrote: > Max Pyziur wrote: > > I dropped my databases, uninstalled the 7.0.2-2 rpms and installed 6.5.3 rpms on > > my development RH6.2 Linux 2.2.14-5.0 system and I still get the anomalous query > > result on that box. > > This is a RedHat 6.2 locale problem. Set LC_COLLATE=C and see if that > fixes things. That didn't do it. But I'll tell you what did give me the (original) results for which I was looking. Looking through the various *rc files which get called in the stock RH6.2 installation I saw that there was a /etc/profile.d/lang.sh file (for bash shells) and lang.csh (for csh shells). I moved the lang.sh to lang.sh.bak (since the login initialization script looks for /etc/profile.d/*sh files), shutdown postmaster and restarted and now I'm getting the results I got before. The thing which I'm concerned about is doing a 'env | sort' doesn't show any of the LC_xxx variable settings. Nor does 'echo $LC_COLLATE'. What command can I use to "expose" these settings to make sure that I don't run into a similar situation? Much thanks to you and tom lane (in his ferlinghetti way) for helping me out of this one (at least to get the original results I had). > -- > Lamar Owen > WGCR Internet Radio > 1 Peter 4:11 > Max Pyziur BRAMA - Gateway Ukraine [EMAIL PROTECTED] http://www.brama.com/
