[SQL] monitor sessions
Hello Can anyone tell me - is there a system table or view that I can query to show all current sessions ? Thanks Chris ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
Re: [SQL] monitor sessions
SELECT * FROM pg_stat_activity; On Fri, 2003-10-10 at 09:48, Chris Faulkner wrote: Hello Can anyone tell me - is there a system table or view that I can query to show all current sessions ? Thanks Chris ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings signature.asc Description: This is a digitally signed message part
Re: [SQL] [postgres] Copy Timestamp NULL
On Thursday 09 October 2003 09:55, Danny Tramnitzke wrote: (...) > Also es geht darum, dass ich in eine Postgres Tabelle per Copy Daten laden > möchte. > Bei einer Spalte handelt es sich um Timestamp NULL ... In der Source-Datei > befinden sich in dieser Spalte ISO Timestamp Werte und NULL - Werte . > (Nicht jede Zeile besitzt einen Timestamp-wert) > > Die Source-Datei sieht prinzipiell so aus : > > 1|Hallo|17.0|1999-01-23 14:30:08.456234|usr01 > 2|Test|18.5||usr02 > > Die Spalte 4 ist somit vom Typ Timestamp. > > Allerdings kann ich diese Source-Datei nicht in die Postgres Tabelle per > Copy laden, da es an den NULL - Stellen zum Fehler kommt : Bad timestamp > external representation '' > > Wenn also eine "Lücke" gefunden wird, interpretiert Copy diese "Lücke" > nicht als Null-Wert und beschwert sich über das fehlerhafte Timestamp > Format. > > Es geht ebenfalls nicht, wenn ich an der entsprechenden Stelle NULL > schreibe. > > Was muss ich also angeben, damit ich solch eine Datei laden kann ? Ich nehme an, Du fuehrst in etwa folgendes aus: COPY x FROM '/pfad/zur/datei' DELIMITER '|'; Da musst Du dann in den Spalten mit einem NULL-Wert \N einfügen, also: 2|Test|18.5|\N|usr02 Das kann auch ein anderer Wert sein, z.B. COPY x FROM '/pfad/zur/datei' DELIMITER '|' NULL 'NULL'; um NULL schreiben zu koennen. Die relevante Stelle in der Dokumentation ist hier: http://www.postgresql.org/docs/7.3/static/sql-copy.html mfg Ian Barwick -- [EMAIL PROTECTED] http://www.postgresql.org/docs/faqs/FAQ_german.html http://sql-info.de/postgresql/de/ Wenn Sie Ihr Abonnement fuer diese Gruppe kuendigen moechten, senden Sie eine E-Mail an: [EMAIL PROTECTED] Die Nutzung von Yahoo! Groups ist Bestandteil von http://de.docs.yahoo.com/info/utos.html ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html
Re: [SQL] [GENERAL] SQL query problem (many table in FROM statement and many LEFT JOIN's)
On Friday 10 October 2003 08:53, Marek Lewczuk wrote: > > > SELECT > > > _CON.con_id, > > > > Please make sure you get the quoting right regarding table > > names. PostgreSQL will fold _CON into _con unless quoted > > "_CON". So, it may be that you created the table with quotes > > ("_CON"). Now, in your query you don't use quotes and thusly > > it is looking for a _con table. The simple rule of thumb is > > to either always or never use quotes. > > I don't think that this is the solution, becouse the query: > > SELECT > _CON.con_id, > _MOD.mod_ty, > _CON.dri_id, > _CON.man_cod, > _ENG.eng_pow > FROM > db_data.mda_mod _MOD, > db_data.mda_mod_con _CON, > db_data.mda_mak_eng _ENG, > db_data.set_mda_fue _FUE > WHERE > _MOD.mod_id = '283' AND > _CON.mod_id = _MOD.mod_id AND > _CON.psd <= NOW() AND > _CON.ped > NOW() AND > _ENG.eng_id = _CON.eng_id AND > _ENG.eng_fue = _FUE.fue_id > > ...is working fine. I belive that this some problem with LEFT JOIN and > FROM statement. If I will rewrite this query: I think what's happening here is the fact that if you use explicit joins in a query that forces the order of the joins. You originally had: db_data.mda_mod _MOD, db_data.mda_mod_con _CON, db_data.mda_mak_eng _ENG, db_data.set_mda_fue _FUE LEFT JOIN db_data.mda_mod_ver _VER ON _VER.ver_id = _CON.ver_id LEFT JOIN db_data.mda_mod_yea _YEA ON _YEA.yea_id = _CON.yea_id which was being parsed as something like: ( (_FUE LEFT JOIN _VER) LEFT JOIN _YEA ), _MOD, _CON, ENG Of course, if it tries to evaluate in this order it can't see _CON from the innermost brackets. I believe the "force planner order" is configurable in the forthcoming 7.4 -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html