[GENERAL] Loop through all views with PHP

2007-06-18 Thread Stefan Schwarzer
Hi there, my app is creating views for a certain task; now, I would like to run on a regular basis a script which deletes these views. As they are named with the date/hour/min/sec-appendix to make each view unique, I don't know the names myself (Ok, I could stock the names in a separate t

[GENERAL] SQL query with IFs (?) to "Eliminate" NULL Values

2007-09-05 Thread Stefan Schwarzer
Hi there, I want to calculate per Capita values on-the-fly, taking for example the "Total GDP" data set and divide it by "Total Population". Now, each of these data sets have a couple of "0" or "-" values (the latter being the indicator for : "no data available"). Until now I have it

[GENERAL] Rankinf of Results?

2007-09-06 Thread Stefan Schwarzer
Hi there, I would like to achieve some kind of rating of the results of a query. As it searches in different fields of the (metadata) database, matching keywords of the field of the "data variable names" are more important than matching keywords in the "description" field... I have no ide

[GENERAL] Alias "all fields"?

2007-09-06 Thread Stefan Schwarzer
Hi there, I guess I am demanding too much But it would be cool to have some kind of alias for "all fields". What I mean is this here: Instead of this: SELECT * FROM gdp WHERE y1970 NOT NULL AND y1971 NOT NULL AND y2005 NOT NULL I would like to have this: SELECT *

Re: [GENERAL] Alias "all fields"?

2007-09-06 Thread Stefan Schwarzer
5 3 NULL 94 102 What do you think? Greetings, -Franz -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Stefan Schwarzer Gesendet: Donnerstag, 6. September 2007 13:43 An: pgsql-general@postgresql.org Betreff: [SPAM] [GEN

Re: [GENERAL] Alias "all fields"?

2007-09-10 Thread Stefan Schwarzer
Ouff thanks for all these replies. A reason for this kind of design yeah, I guess these here: a) not being a professional database designer b) import through Excel exports... that is, the QC, harmonization and aggregations are being done in Excel, and then the final result is being e

[GENERAL] Database/Table Design for Global Country Statistics

2007-09-12 Thread Stefan Schwarzer
Hi there, I learned in another posting that my table design - in a polite way - "could be improved". So, before doing any additional design errors, I would like to get feedback, if possible. I am dealing with some 500 tables for worldwide national statistics (GDP, population, environmen

Re: [GENERAL] Database/Table Design for Global Country Statistics

2007-09-12 Thread Stefan Schwarzer
Thanks for the feedback and the suggestions. A problem I have now when using the new design is the following: As a result from my PostGres query I get something like this: year|value |name --- 2001| 123 | Afghanistan

Re: [GENERAL] Database/Table Design for Global Country Statistics

2007-09-12 Thread Stefan Schwarzer
e). All I can do is offer you a moment of relaxation by looking at some really nice nature/landscape photos @ http://photoblog.la-famille-schwarzer.de Cheers, Stef On Sep 12, 2007, at 11:45 AM, Richard Huxton wrote: Stefan Schwarzer wrote: Thanks for the feedback and the suggestions. A

Re: [GENERAL] Database/Table Design for Global Country Statistics

2007-09-13 Thread Stefan Schwarzer
$curr_yr = -1 $cols = array(); while () { if ($row['year'] != $curr_yr) { if (sizeof($cols) > 0) { display_table_row($cols); } $cols = array(); $curr_year = $row['year']; } $cols[] = $row['value']; } // handle possible last row of table if (sizeof($cols) > 0) { display_table_row(

Re: [GENERAL] Database/Table Design for Global Country Statistics

2007-09-13 Thread Stefan Schwarzer
$curr_yr = -1 $cols = array(); while () { if ($row['year'] != $curr_yr) { if (sizeof($cols) > 0) { display_table_row($cols); } $cols = array(); $curr_year = $row['year']; } $cols[] = $row['value']; } // handle possible last row of table if (sizeof($cols) > 0) { display_table_ro

Re: [GENERAL] Database/Table Design for Global Country Statistics

2007-09-13 Thread Stefan Schwarzer
Umm - not sure what you're after. What's wrong with one of: SELECT ... ORDER BY year, value SELECT ... ORDER BY value, year Or did you want a particular year pulled out of the general list, in which case try something like: SELECT ... ORDER BY (year = 1970), year, value SELECT ... OR

Re: [GENERAL] Database/Table Design for Global Country Statistics

2007-09-13 Thread Stefan Schwarzer
Uiuiui and it gets even worse... I want to implement the possibility to calculate on-the-fly the per Capita values for the selected data set. With the "old" table design it would be something like this: SELECT (fish_catch.y_1970 / pop_total.y_1970), (fish_catch.y_1971 / pop_tota

[GENERAL] Data Model - Linking to PHP Code - Literature

2007-09-13 Thread Stefan Schwarzer
Of course you should really have a data model that knows what it wants to sort by and constructs the query appropriately. The table- drawing code can then ask the data-model for heading-names and sort- order details. It's more work up-front, but you only have to do it once and then you can

Re: [GENERAL] Database/Table Design for Global Country Statistics

2007-09-14 Thread Stefan Schwarzer
SELECT f.year, f.id, c.name, (f.value / p.value) AS per_capita FROM fish_catch AS f JOIN pop_total AS p USING (year, id) INNER JOIN countries AS c ON f.id = c.id ORDER BY (year = 2005), value, name Seems to never end Why is redesigning tables so difficult?! :-)) And fur

[GENERAL] Calculate Weighted Aggregation between Two Tables

2007-09-19 Thread Stefan Schwarzer
mathematical procedure... Could someone give me a hint how this could be achieved? Thanks for any help! Stef _______ Stefan Schwarzer Nature Photography: http://photoblog.la-famille-schwarzer.de UNEP GEO Data Portal: http://geodata.grid.unep.ch ___

[GENERAL] Compare Content in Multidimensional Array [PHP/SQL]

2007-09-26 Thread Stefan Schwarzer
the "smallest_common_year"?! If not, I wonder how, by using PHP, I can get that information... Can anyone give me a hint? Thank you very much! Stef ____ Stefan Schwarzer Lean Back and Relax - Enjoy some Nature P

[GENERAL] Find "smallest common year"

2007-09-27 Thread Stefan Schwarzer
hanks for any help! Stef ________ Stefan Schwarzer Lean Back and Relax - Enjoy some Nature Photography: http://photoblog.la-famille-schwarzer.de Appetite for Global Data? UNEP GEP Data Portal: http://geodata.grid.unep.ch

Re: [GENERAL] Find "smallest common year"

2007-09-27 Thread Stefan Schwarzer
wrote: If I understood your question, maybe it's you want: SELECT min() FROM table1 JOIN table2 ON (table1.data_field = table2.data_field); 2007/9/27, Stefan Schwarzer <[EMAIL PROTECTED] >: Hi there, my aim is to plot a line graph for a single country but for two or three

Re: [GENERAL] Find "smallest common year"

2007-09-27 Thread Stefan Schwarzer
es, 500 regional and 500 subregional and 500 global aggregations? Years being covered having something between 10 and 60 years for each of these variables. All available for 240 countries/ territories. Thanks for any recommendations! Stef Stefan Schwarzer wrote: Sorry, I forgot to men

[GENERAL] Normalized Tables & SELECT [was: Find "smallest common year"]

2007-09-28 Thread Stefan Schwarzer
last time we came up with SubSelects for each year. So, does this make sense? Thanks a lot for your help! Stef ________ Stefan Schwarzer Lean Back and Relax - Enjoy some Nature Photography: http://photob

[GENERAL] How to avoid: 9.50184e+06

2007-09-28 Thread Stefan Schwarzer
Hi there, how can I avoid results like this: 9.50184e+06 Instead it should return the "real" value, as 950184. Thanks for any hints! Stef Lean Back and Relax - Enjoy some Nature Photography: http://photoblog.la-famille

Re: [GENERAL] Normalized Tables & SELECT [was: Find "smallest common year"]

2007-09-28 Thread Stefan Schwarzer
Ah, but there is a standardised list of country-codes ideal for the DBA since the code is (usually) easily understandable. http://en.wikipedia.org/wiki/ISO_3166 The only problem might be if historical data uses old boundaries (e.g. Soviet Union, Yugoslavia). Yep, have all of them (ISO-2, I

Re: [GENERAL] Normalized Tables & SELECT [was: Find "smallest common year"]

2007-10-01 Thread Stefan Schwarzer
- one table for the years names/ids/etc. (1970, 1; 1971, 2; 1973, 3; ) If you _do_ need this table (because you want to constrain your statistical data to only contain a specific set of years, or because you need a quick list of available years to select from): Make the year pri

Re: [GENERAL] Normalized Tables & SELECT [was: Find "smallest common year"]

2007-10-01 Thread Stefan Schwarzer
BTW, You didn't actually use type text for your year column, did you? No quotes needed then. Otherwise you'd have to make sure your year values are all the same length or sorting gets... interesting. Yep, my comment just before concerns especially this paragraph, I guess. With not only ye

Re: [GENERAL] Normalized Tables & SELECT [was: Find "smallest common year"]

2007-10-01 Thread Stefan Schwarzer
I find it far easier to maintain normalized tables that produced non-normalized ones (for things like data warehousing) than it is to maintain non-normalized tables and trying to produce normalized data from that. Ok, I do understand that. So, instead of the earlier mentioned database design, I

Re: [GENERAL] Normalized Tables & SELECT [was: Find "smallest common year"]

2007-10-01 Thread Stefan Schwarzer
An entirely different question is whether it is a good idea to write a range as a value that the database cannot interpret correctly (referring to the '1970-75' notation). You cannot group records by value this way if you need to (for example) combine data from '1970' with data from '1970-75'

[GENERAL] Find min year and min value

2007-10-02 Thread Stefan Schwarzer
Hi there, I am trying to find in a table with different variables, countries and years the lowest year and within that year the lowest value The following SELECT works, but I wonder if it is "elegant". Can you recommend any other solution? SELECT

Re: [GENERAL] Find min year and min value

2007-10-02 Thread Stefan Schwarzer
Hi there, I am trying to find in a table with different variables, countries and years the lowest year and within that year the lowest value The following SELECT works, but I wonder if it is "elegant". Can you recommend any other solution? SELECT value AS minv FROM public_on_table.d

Re: [GENERAL] Find min year and min value

2007-10-02 Thread Stefan Schwarzer
SELECT year, value FROM ... I feel ashamed such a simple solution... gush Thanks for that! Unfortunately it doesn't stop there... If I want to find the "common smallest year" for two given variables (say, I have years 1970, 1971, 2005 for variable 1 (GDP) and 1980, 1981,... 200

Re: [GENERAL] Find min year and min value

2007-10-02 Thread Stefan Schwarzer
to get your advice. Thanks a lot! Stef ________ Stefan Schwarzer Lean Back and Relax - Enjoy some Nature Photography: http://photoblog.la-famille-schwarzer.de Appetite for Global Data? UNEP GEO Data Portal:

Re: [GENERAL] Find min year and min value

2007-10-04 Thread Stefan Schwarzer
Having 500 statistical global national variables for about 240 countries/territories. Need to do regional aggregations, per Capita calculations and some completeness computations on-the-fly. id_variable |year|value |id_country Both Steve and I have given you alternat

[GENERAL] How to convert rows into HTML columns?

2007-10-04 Thread Stefan Schwarzer
Hi there, I feel like a brain-washed person being slowly re-socialized. After changing from an Excel-like database design to a "central table" one (see here: http://archives.postgresql.org/pgsql-general/2007-10/ msg00132.php ) I am struggling with multiple problems... One is now the HTML t

Re: [GENERAL] How to convert rows into HTML columns?

2007-10-05 Thread Stefan Schwarzer
And the next question coming up is: How should my query look like so that I can sort the (HTML) table by a specific year in ascending or descending order? So, that it doesn't display it by the country names alphabetical order, but by, say 1998? If you have only one row, how would you sort this

Re: [GENERAL] Find min year and min value

2007-10-05 Thread Stefan Schwarzer
Alternately, you could have a gdp table and a fish_catch table which would be easily joined to give the same result. Expanding on this: create table fish_catches (country text not null, data_year date not null, primary key (country, data_yea

Re: [GENERAL] Find min year and min value

2007-10-05 Thread Stefan Schwarzer
Hmmm. Don't really get that query working. My SQL looks like this now: SELECT id_country, year, value FROM internet_users NATURAL JOIN gdp WHERE id_country = 8 ORDER BY year LIMIT 1 Ok, got it working with another proposed SQL SELECT. This is a solution (comes out

[GENERAL] ORDER BY - problem with NULL values

2007-10-10 Thread Stefan Schwarzer
Thanks for any info... Stef ________ Stefan Schwarzer Lean Back and Relax - Enjoy some Nature Photography: http://photoblog.la-famille-schwarzer.de Appetite for Global Data? UNEP GEO Data Portal: http://geodata.grid.unep.ch

Re: [GENERAL] ORDER BY - problem with NULL values

2007-10-10 Thread Stefan Schwarzer
Hi there, if I order a given year in DESCending ORDER, so that the highest values (of a given variable) for the countries are displayed at the top of the list, then actually the NULL values appear as first. Only below, I find the values ordered correctly. Is there any way to a) make the

[GENERAL] Calculation of per Capita on-the-fly - problems with SQL syntax

2007-10-11 Thread Stefan Schwarzer
Hi there, I need to calculate per Capita data on-the-fly. My table for a given variable looks like this: year|value |id_country --- 2001| 123 | 1 2002| 125 | 1 2003| 128 |

Re: [GENERAL] ORDER BY - problem with NULL values

2007-10-11 Thread Stefan Schwarzer
From 8.3 beta release notes: - ORDER BY ... NULLS FIRST/LAST I think this is what you want right? Yes, indeed. Sounds great. unfortunately I am on 8.1. And wouldn't really want to migrate to 8.3 and beta for the moment Thanks anyway! Stef ---(end of broadca

Re: [GENERAL] Calculation of per Capita on-the-fly - problems with SQL syntax

2007-10-15 Thread Stefan Schwarzer
This should give you the same data out in a different format. Note that most of the NULL values will be excluded from this result. SELECT cname, year, d.value/pt.value FROM public_multiple_tables.agri_area AS d INNER JOIN public_multiple_tables.pop_total AS pt ON pt.id_country = d.id_c

Re: [GENERAL] Calculation of per Capita on-the-fly - problems with SQL syntax

2007-10-16 Thread Stefan Schwarzer
I suggest using two *date* (or possibly integer) columns for each row and consider each row an year interval (in the mathematical sense, not to be confused with SQL intervals, which are actually durations). Depending on the interval representation you choose (closed-open or closed-closed),

Re: [GENERAL] Calculation of per Capita on-the-fly - problems with SQL syntax

2007-10-16 Thread Stefan Schwarzer
SELECT DISTINCT ( CASE WHEN d.year=2003 AND pt.year=2003 AND pt.value <> '0' AND pt.value IS NOT NULL THEN d.value / pt.value ELSE NULL END ) AS y_2003, ( CASE WHEN d.year=2002 AND pt.year=2002 AND pt.value <> '0' AND pt.value IS NOT NULL THEN d.value / pt.value ELSE NULL END ) AS y_2

[GENERAL] Crosstab Problems

2007-10-18 Thread Stefan Schwarzer
Hi there, successfully installed the tablefunc package. Now, I would like to transform this kind of result based on a normal SQL: c_name |year|value --- Germany | 2001| 123 Germany | 2002| 125 Germany

Re: [GENERAL] Crosstab Problems

2007-10-18 Thread Stefan Schwarzer
Could you provide a self-contained test case for this? There's not really enough information here for someone else to duplicate the problem. Also, which PG version are you using? Wasn't sure what you ment with "a self containted test case". Is it the raw data? Here is a SQL dump for the ta

Re: [GENERAL] Crosstab Problems

2007-10-19 Thread Stefan Schwarzer
But when re-doing the query now without the JOIN, it works (almost): SELECT * FROM crosstab( 'SELECT id_country AS id, year_start AS year, value FROM agri_area AS d WHERE year_start = 2003 OR year_start = 2

[GENERAL] (Never?) Kill Postmaster?

2007-10-23 Thread Stefan Schwarzer
Hi there, I read dozens of times the "TIP 2: Don't 'kill -9' the postmaster"... Now, what am I supposed to do if I launched a query which takes ages, and which I want to interrupt? Thanks for any advice, Stef _____

[GENERAL] "Concatenate" two queries - how?

2007-10-24 Thread Stefan Schwarzer
Hi there, I have two queries, which I would like to bring together to form one result. The first query is a simple SELECT on a table of national statistics. SELECT COALESCE(c.name, ), year_start AS year, value FROM fish_catch AS d LEFT JOIN countri

[GENERAL] Substitute column in SELECT with static value?

2007-11-16 Thread Stefan Schwarzer
substitute this with a "static" value, such as "Global"? So, that the query still results in three columns? Thanks for any advice! Stef ________ Stefan Schwarzer Lean Back and Relax - Enjoy some Nature Photo

Re: [GENERAL] Substitute column in SELECT with static value? (Crosstab problem?)

2007-11-18 Thread Stefan Schwarzer
Hi there, I run an aggregation on national statistics to retrieve regional values (for Africa, Europe, ...). Now, I want to have a global aggregation as well. The easiest thing for my PHP/HTML procedure would be to have the global row make appear within the regional result. So it would

[GENERAL] UNION not working... why?

2007-12-13 Thread Stefan Schwarzer
o_3_code = 'CH')) ORDER BY d.year_start DESC LIMIT 1 ________ Stefan Schwarzer Lean Back and Relax - Enjoy some Nature Photography http://photoblog.la-famille-schwarzer.de Appetite for Global Data? UNEP GEO Data Portal: http://geodata.grid.unep.ch

Re: [GENERAL] UNION not working... why?

2007-12-13 Thread Stefan Schwarzer
Oh great. Thanks a lot. But now, I have another problem in this context. If I use text in the SELECT statement (so, that the final output gives me the name of the selected variables, plus the year and the value) than I get this error message: ERROR: failed to find conversion function from

Re: [GENERAL] UNION not working... why?

2007-12-13 Thread Stefan Schwarzer
But now, I have another problem in this context. If I use text in the SELECT statement (so, that the final output gives me the name of the selected variables, plus the year and the value) than I get this error message: ERROR: failed to find conversion function from "unknown" to text [squint...]

[GENERAL] Installation problem: failed to initialize lc_messages to ""

2008-01-09 Thread Stefan Schwarzer
Hi there, I am trying to install Postgres 8.1.11 on Mac Leopard. Compilation was ok. Now, the initdb has some problems: $ /usr/local/pgsql/bin/initdb -D --locale=C /Users/schwarzer/Documents/ data_postgres ... selecting default max_connections ... 10 selecting default shared_buffers ... 50

Re: [GENERAL] Installation problem: failed to initialize lc_messages to ""

2008-01-10 Thread Stefan Schwarzer
FATAL: XX000: failed to initialize lc_messages to "" LOCATION: InitializeGUCOptions, guc.c:2666 Typically what this means is that you have an improper setting of LANG or LC_ALL in your environment ("improper" meaning that it doesn't match any of the locales that are actually installed on yo

Re: [GENERAL] Installation problem: failed to initialize lc_messages to ""

2008-01-10 Thread Stefan Schwarzer
FATAL: XX000: failed to initialize lc_messages to "" LOCATION: InitializeGUCOptions, guc.c:2666 Typically what this means is that you have an improper setting of LANG or LC_ALL in your environment ("improper" meaning that it doesn't match any of the locales that are actually installed on yo

Re: [GENERAL] Installation problem: failed to initialize lc_messages to ""

2008-01-10 Thread Stefan Schwarzer
/usr/local/pgsql/bin/initdb -D --locale=en_US.UTF-8 /Users/ schwarzer/Documents/data_postgres Dunno if it'll make a difference, but I'd put the "-D" immediately before the path to the data directory. Thanks for the hint. But unfortunately same error message --

Re: [GENERAL] Installation problem: failed to initialize lc_messages to ""

2008-01-10 Thread Stefan Schwarzer
/usr/local/pgsql/bin/initdb -D --locale=en_US.UTF-8 /Users/schwarzer/Documents/data_postgres Dunno if it'll make a difference, but I'd put the "-D" immediately before the path to the data directory. Also, pay attention to the first few lines of initdb output --- it will tell you what it think

Re: [GENERAL] Installation problem: failed to initialize lc_messages to ""

2008-01-10 Thread Stefan Schwarzer
g42:~ tgl$ ls -lR /usr/share/locale/en_US.UTF-8 total 40 lrwxr-xr-x 1 root wheel 28 Apr 26 2006 LC_COLLATE -> ../ la_LN.US-ASCII/LC_COLLATE lrwxr-xr-x 1 root wheel 17 Apr 26 2006 LC_CTYPE -> ../UTF-8/ LC_CTYPE drwxr-xr-x 3 root wheel 102 Mar 20 2005 LC_MESSAGES lrwxr-xr-x 1

Re: [GENERAL] Installation problem: failed to initialize lc_messages to ""

2008-01-14 Thread Stefan Schwarzer
I'm wondering if some of those files are missing, or the symlinks are dangling, on yours. Hmmm. here is what I have. Looks pretty similar Running out of easy answers, aren't we :-( The next thing I can think of is to run initdb under "ktrace -i" and compare the results with a worki

[GENERAL] Forgot to dump old data before re-installing machine

2008-01-14 Thread Stefan Schwarzer
Hi there, I re-installed my machine and "forgot" to dump my database(s). I naturally still have the whole database folders. For the moment I installed the "old" postgres version (8.1) to be able to read my data. But how can I read them? It seems that it doesn't work that I just overwrite

[GENERAL] Postgres installation on Leopard; database on Mac-User-Level

2008-01-15 Thread Stefan Schwarzer
Hi there, I want to create my database not under /etc/ but under or within my Mac-user level, that is /Users/schwarzer/ Now, it seems somewhat complicated - at least for me -, due to the different read-write permissions, to do that. It worked before, but now, after re-installing t

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-15 Thread Stefan Schwarzer
I re-installed my machine and "forgot" to dump my database(s). I naturally still have the whole database folders. For the moment I installed the "old" postgres version (8.1) to be able to read my data. But how can I read them? It seems that it doesn't work that I just overwrite the new database

Re: [GENERAL] Postgres installation on Leopard; database on Mac-User-Level

2008-01-15 Thread Stefan Schwarzer
Now, it seems somewhat complicated - at least for me -, due to the different read-write permissions, to do that. It worked before, but now, after re-installing the machine, I really don't get it going... The commands would be like this: /usr/local/pgsql/bin/initdb -D /Users/schwarzer/Docu

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-15 Thread Stefan Schwarzer
I re-installed my machine and "forgot" to dump my database(s). I naturally still have the whole database folders. For the moment I installed the "old" postgres version (8.1) to be able to read my data. But how can I read them? It seems that it doesn't work that I just overwrite the new database

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-15 Thread Stefan Schwarzer
Ok, did what you said: stopping server, deleting "newly" created "data" directory, re-running initdb, starting the server, stopping the server. Renamed "empty" data directory. Restarting server: NOT COMPLAINING "you need to run initdb" or something else Although it's saying that it st

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-16 Thread Stefan Schwarzer
Ok, did what you said: stopping server, deleting "newly" created "data" directory, re-running initdb, starting the server, stopping the server. Renamed "empty" data directory. Restarting server: NOT COMPLAINING "you need to run initdb" or something else Although it's saying that it

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-16 Thread Stefan Schwarzer
| The logfile is telling me this when I try to start the server with my | "old" data folder: | | FATAL: database files are incompatible with server | DETAIL: The database cluster was initialized with PG_CONTROL_VERSION | 738394112, but the server was compiled with PG_CONTROL_VERSION 812. |

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-17 Thread Stefan Schwarzer
This looks like an endianess mismatch; did you already mention on what architecture you are on? MacPro, Leopard Did you just move from a PPC-based Mac to an Intel-based one? If so, you're out of luck --- you need to go back to the PPC to make a dump of those files. No, I just re-installe

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-17 Thread Stefan Schwarzer
This looks like an endianess mismatch; did you already mention on what architecture you are on? MacPro, Leopard Did you just move from a PPC-based Mac to an Intel-based one? If so, you're out of luck --- you need to go back to the PPC to make a dump of those files. No, I just re-installe

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-18 Thread Stefan Schwarzer
Ok, it seems to be related to a Intel/PPC issue, as Martijn and Tom suggested. So, I copied all files to a PPC, but which runs Linux - don't know if this is important. Now, it tells me: "Fatal error: Incorrect checksum on control file" Any way out of this? Thanks for any advice. That's the ki

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-18 Thread Stefan Schwarzer
Did you just move from a PPC-based Mac to an Intel-based one? If so, you're out of luck --- you need to go back to the PPC to make a dump of those files. No, I just re-installed my Intel Mac. First I just upgraded from Tiger to Leopard (without getting my database to run; but I didn't put

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-24 Thread Stefan Schwarzer
As for the real problem (on the same hardware), when you rebuilt Postgres on your new machine did you change any of the configure options that MacPorts would have used from what would have been used previously (I assume they can be overridden)? There's not that much that can be overridden that w

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-24 Thread Stefan Schwarzer
On Jan 24, 2008, at 4:41 PM, Tom Lane wrote: Stefan Schwarzer <[EMAIL PROTECTED]> writes: After running initdb the postmaster started smoothly. I stopped it, copied my database files into the same location, started the postmaster again, and then got this error message: schwarzers-ma

Re: [GENERAL] Forgot to dump old data before re-installing machine

2008-01-24 Thread Stefan Schwarzer
When I start the postmaster it seems ok. But there is no process running. Then it didn't really start successfully. (Unless you use the -w option, "pg_ctl start" just launches the postmaster --- it doesn't wait around to see what happens.) You need to look into the log file to see what the pro

[GENERAL] Problem with Crosstab - Allocating value to wrong column

2010-10-19 Thread Stefan Schwarzer
Hi there, I have a database with statistical tables which look like this: id|year_start |value 3 1960 736.1 3 1961 723.3 4 1960 123.4 Years can cover 40 years for each of the countries (ID) and each (v

Re: [GENERAL] Problem with Crosstab (Concatenate Problem)

2010-11-01 Thread Stefan Schwarzer
>> For one of the countries, I have a value for 2007, but not for 1960. >> When using only the inner query, than I see one line: Andorra - 2007 >> - 539 But when running the whole SQL, the value for year 2007 get's >> allocated to the year 1960. The table looks as follows: >> >> name |y_1

Re: [GENERAL] Problem with Crosstab (Concatenate Problem)

2010-11-01 Thread Stefan Schwarzer
>> For one of the countries, I have a value for 2007, but not for 1960. >> When using only the inner query, than I see one line: Andorra - 2007 >> - 539 But when running the whole SQL, the value for year 2007 get's >> allocated to the year 1960. The table looks as follows: >> >> name |y_1

Re: [GENERAL] Problem with Crosstab (Concatenate Problem)

2010-11-01 Thread Stefan Schwarzer
>> I need to convert the integer values for the years into column names, i.e. >> "1965" into "y_1965". How do I achieve this then? > > Try something like: > > create table foo ( > name text, > year_start int, > value float8); > > insert into foo values('a',2010,1.23),('b',2011,2.34); > > SELEC

Re: [GENERAL] Problem with Crosstab (Concatenate Problem)

2010-11-03 Thread Stefan Schwarzer
> What version of PostgreSQL are you running? The error seems to indicate > that you don't have the crosstab(text,text) form of the function. > > In psql do: > contrib_regression=# \df crosstab > List of functions > Schema | Name | Result data type | Argument data type

Re: [GENERAL] Problem with Crosstab (Concatenate Problem)

2010-11-04 Thread Stefan Schwarzer
>> What version of PostgreSQL are you running? The error seems to indicate >> that you don't have the crosstab(text,text) form of the function. >> >> In psql do: >> contrib_regression=# \df crosstab >> List of functions >> Schema | Name | Result data type | Argument dat

[GENERAL] Dump schema without the functions

2008-01-31 Thread Stefan Schwarzer
Hi there, how can I dump a schema with all tables, but without the functions? Is there a way to do it, or do I have to manually drop the functions later when having used the pg_restore? Thanks for any advice, Stef smime.p7s Description: S/MIME cryptographic signature

Re: [GENERAL] Dump schema without the functions

2008-01-31 Thread Stefan Schwarzer
how can I dump a schema with all tables, but without the functions? There's no built-in single command for that. You can accomplish it by using pg_restore -l to make a list of objects, then edit the list, then pg_restore -L to restore only the objects in the edited list. Hmmm.. I probably sho

Re: [GENERAL] Dump schema without the functions

2008-02-01 Thread Stefan Schwarzer
how can I dump a schema with all tables, but without the functions? There's no built-in single command for that. You can accomplish it by using pg_restore -l to make a list of objects, then edit the list, then pg_restore -L to restore only the objects in the edited list. Hmmm.. I probably sh

[GENERAL] pg_restore fails for postgis data dump

2008-02-01 Thread Stefan Schwarzer
Hi there, I just wanted to restore a dump which I did, which includes some postgis data. But, it doesn't work and instead I get this error message: pg_restore: restoring data for table "boundaries_national" pg_restore: [archiver (db)] error returned by PQputCopyData: server closed the conn

Re: [GENERAL] Forgot to dump old data before re-installing machine [solved]

2008-02-01 Thread Stefan Schwarzer
When I start the postmaster it seems ok. But there is no process running. Then it didn't really start successfully. (Unless you use the -w option, "pg_ctl start" just launches the postmaster --- it doesn't wait around to see what happens.) You need to look into the log file to see what the pro

Re: [GENERAL] Dump schema without the functions

2008-02-01 Thread Stefan Schwarzer
But I don't really get how the final command will look like. pg_restore -L -d But somewhere I have to indicate the original file, no? I mean, where do all my data now come from? The original dump contains all data; the newly created via pg_restore -l geodataportal.public | grep

[GENERAL] "pg_ctl: cannot be run as root"

2008-02-04 Thread Stefan Schwarzer
Hi there, I installed postgres without creating another postres user/admin than myself, as there is no other user on my machine and it's only for testing purposes. But strange enough, I only can start the postgres server from time to time, normally when I have freshly restarted the machin

[GENERAL] Dump/Transfer Sequence Problems

2008-04-09 Thread Stefan Schwarzer
Hi, I am using Navicat to transfer data from one database to another. But it soon gives me an error message like the following: [Err] [Dtf] Transfer Data [create table "admin"."news" ( "id" int4 not null default nextval('news_id_seq1'::regclass) , "date" date , "text_en" text , "text_fr

Re: [GENERAL] Dump/Transfer Sequence Problems

2008-04-10 Thread Stefan Schwarzer
I am using Navicat to transfer data from one database to another. But it soon gives me an error message like the following: I think you'll probably have to ask the navicat people. If you want to use pg_dump to transfer data from 8.1 to 8.2 though, use the version of pg_dump that ships with 8

[GENERAL] Proper Installation of Postgres and Postgis on 10.5 Intel

2008-04-10 Thread Stefan Schwarzer
I tried now for weeks to get postgres & postgis going on my machine, in vain... Lots of frustration has been built up, lots of energy went into it... But nothing goes... I mean, postgres is running, postgis is installed, but it constantly craches, doesn't accept shp2pgsql imports etc... S

[GENERAL] The default text search configuration will be set to "simple" ?

2008-04-13 Thread Stefan Schwarzer
Hi there, what does this message mean? I didn't find any information on the web, beside of others having similar messages... -- The database cluster will be initialized with locales COLLATE: en_US.UTF-8 CTYPE:UTF-8 MESSAGES: en_US.UTF-8 MONETARY:

Re: [GENERAL] The default text search configuration will be set to "simple" ?

2008-04-14 Thread Stefan Schwarzer
what does this message mean? I didn't find any information on the web, beside of others having similar messages... -- The database cluster will be initialized with locales COLLATE: en_US.UTF-8 CTYPE:UTF-8 This one is missing the en_US off the front. UTF-8

Re: [GENERAL] Dump/Transfer Sequence Problems

2008-04-14 Thread Stefan Schwarzer
I am using Navicat to transfer data from one database to another. But it soon gives me an error message like the following: I think you'll probably have to ask the navicat people. If you want to use pg_dump to transfer data from 8.1 to 8.2 though, use the version of pg_dump that ships with 8

[GENERAL] Installation of contrib/tablefunc - problems

2008-04-15 Thread Stefan Schwarzer
Hi there, small problem with installing the tablefunc libs. I have a 8.3.1 running on my Mac 10.5. Now, I would like to add tablefunc. Last time, I did it the following way: # in the downloaded postgres package directory $ ./compile # in the tablefunc dir $ USE_PGXS=1 sudo make $ USE_PGXS=1

Re: [GENERAL] Installation of contrib/tablefunc - problems

2008-04-15 Thread Stefan Schwarzer
ld: file not found: ../../src/backend/postgres It appears to be trying to link to the postgres executable (which is presumably built with --export-dynamic to usefully permit that). The postgres executable doesn't appear to be there. At a guess, the module expects to be built from a particular l

[GENERAL] Substring Problem

2008-05-13 Thread Stefan Schwarzer
Hi there, it seems to work with 8.1, but not anymore with 8.3. What is wrong with this substring request? Or is it some installation issue? Thanks for any suggestion! SELECT substring(date from 1 for 7) AS stryearmonth, COUNT(id) AS countofnumber FROM (SELECT * from downloads ) AS foo GROUP

Re: [GENERAL] Substring Problem

2008-05-13 Thread Stefan Schwarzer
COUNT(id) AS countofnumber FROM (SELECT * from downloads ) AS foo GROUP BY stryearmonth ORDER BY stryearmonth ASC btw, whats the reason for the subselect? Oh, right, looks a bit stupid like this. It's eventually being filled with something more useful, upon the user's request. It's dynamica

[GENERAL] Underscore "_" in LIKE pattern

2008-05-14 Thread Stefan Schwarzer
Hi there, I would like to get a list of all tables in my schema which begin with "in_". But as the "underscore (_) in pattern stands for (matches) any single character", my query: SELECT * FROM pg_tables WHERE schemaname='public' AND tablename LIKE 'in_%' ORDER BY tablename ASC doesn't

[GENERAL] pg_query & $result re-fill

2008-06-10 Thread Stefan Schwarzer
Hi there, I used to pass a the $result of a pg_query to a function which detects min, max etc. Now, I inserted before that another query which first queries a set of parameters for the selected regions. Only if these parameters are fulfilled for each of the regions, the values of the abov

  1   2   >