[HACKERS] windows new-line to linux new-line
is there same easy way to turn on translation bettwen client and server from linux new-line style (0x0A) to windows style (0x0A0D?) (something like conversions) ? ---(end of broadcast)--- TIP 8: explain analyze is your friend
[HACKERS]
Hi Ivan, maybe your're looking for something like this: http://rcamera.org/cgi-bin/man2html.cgi?1+unix2dos HTH, Jürgen Cappel ivan [EMAIL PROTECTED] schrieb am 27.12.2003, 14:19:10: is there same easy way to turn on translation bettwen client and server from linux new-line style (0x0A) to windows style (0x0A0D?) (something like conversions) ? ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [HACKERS] Docu question
Michael Meskes wrote: In manage-ag.sgml our docs says: [...] risk. To allow it, you must compile productnamePostgreSQL/ with the C preprocessor macro literalALLOW_ABSOLUTE_DBPATHS/ defined. One way to do this is to run the compilation step like this: programlisting gmake CPPFLAGS=-DALLOW_ABSOLUTE_DBPATHS all /programlisting [...] I wonder if there's a reason to suggest this gmake call. After all it makes gmake disregard the CPPFLAGS settings in the Makefile. This for instance breaks ecpg compilation on Linux as -D_GNU_SOURCE as defined in the Makefiles is needed for LONG_LONG_MIN. I think we should either change the docs or start using override in the Makefiles. Agreed. This is a problem. -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup.| Newtown Square, Pennsylvania 19073 ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [HACKERS] [PATCHES] update i386 spinlock for hyperthreading
Hi Manfred, I'm using unixware 7 but couldn't compile your source with native cc, I had to compile it with gcc. here are the results: Script started on Sat Dec 27 17:50:49 2003 /tmp 17:50:50: ./a.out MOVETEST called by non-superuser, running with normal priority. zerotest: -1073736628 ticks; zerotest:-4372 ticks; zerotest: -52 ticks; rep nop: 508 ticks; rep nop:88 ticks; rep nop:60 ticks; nop: 256 ticks; nop: 224 ticks; nop:92 ticks; nop:64 ticks; nop:12 ticks; nop: 8 ticks; nop: 0 ticks; nop:-4 ticks; rep nop:56 ticks; rep nop:44 ticks; rep nop:40 ticks; zerotest: -4 ticks; rep nop:24 ticks; zerotest: -4 ticks; nop: 0 ticks; zerotest: -4 ticks; nop:-8 ticks; zerotest: -8 ticks; rep nop:32 ticks; nop: -16 ticks; zerotest: -4 ticks; zerotest: -4 ticks; rep nop:24 ticks; zerotest: -4 ticks; nop: -12 ticks; ^? /tmp 17:53:34: exit script done on Sat Dec 27 17:53:38 2003 Regards On Sat, 27 Dec 2003, Manfred Spraul wrote: Date: Sat, 27 Dec 2003 12:22:45 +0100 From: Manfred Spraul [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [PATCHES] update i386 spinlock for hyperthreading Hi Olivier, I have attached rep_nop.cpp. It's a simple C program (unfortunately filled with linux specific gccisms) that benchmarks the time for a single rep;nop instruction, compared to a normal nop and nothing at all. Which OS do you use? I can try to build an app for FreeBSD, and it should be possible to compile it under Windows with cygwin as well. Under Linux: $ gcc -O2 -o rep_nop rep_nop.cpp $ ./rep_nop Just run in for a few seconds and send back the output. Please add the mailing list back into the cc list. -- Manfred -- Olivier PRENANT Tel: +33-5-61-50-97-00 (Work) 6, Chemin d'Harraud Turrou +33-5-61-50-97-01 (Fax) 31190 AUTERIVE +33-6-07-63-80-64 (GSM) FRANCE Email: [EMAIL PROTECTED] -- Make your life a dream, make your dream a reality. (St Exupery) ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [HACKERS] new-line
its must be in run time, server should has text with linux new line, and if clinet is windows, postgres would convert \n to \n\r but when clinet is also linux postgresa can do nothing about it :) any idea ? On Sat, 27 Dec 2003, [iso-8859-1] Jürgen Cappel wrote: Hi Ivan, maybe your're looking for something like this: http://rcamera.org/cgi-bin/man2html.cgi?1+unix2dos HTH, Jürgen Cappel ivan [EMAIL PROTECTED] schrieb am 27.12.2003, 14:19:10: is there same easy way to turn on translation bettwen client and server from linux new-line style (0x0A) to windows style (0x0A0D?) (something like conversions) ? ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [HACKERS] [PATCHES] update i386 spinlock for hyperthreading
[EMAIL PROTECTED] wrote: Hi Manfred, I'm using unixware 7 but couldn't compile your source with native cc, I had to compile it with gcc. here are the results: Thanks. The test app compares the time needed for three different short loops: a loop with six empty function calls, a loop with six function calls and one nop in the middle, and a loop with a rep;nop; in the middle. Result: - nop needs 0 cycles - executed in parallel. - rep;nop between 24 and 60 cycles - long enough that the pipeline is emptied. I've searched around for further info regarding the recommended spinlock algorithm: - The optimization manual (google for Intel 248966) contains a section about pause instructions: The memory ordering violation is from the multiple simultaneous reads that are executed due to pipelining the busy loop. - It references the Application Note AP-949 Using Spin-Loops on Intel Pentium 4 Processor and Intel Xeon Processor for further details. Unfortunately the app notes are stored on cedar.intel.com, and that server appears to be down :-( -- Manfred ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html
Re: [HACKERS] [GENERAL] Strange permission problem regarding pg_settings
[ please respect moving of thread to pg-hackers ] Joe Conway [EMAIL PROTECTED] writes: ISTM that we want the relations in the un-rewritten query checked based on the basis of the user referencing the rule and for the modes used in the un-rewritten query -- suggesting the change need be reverted. Reverting the change will bring back the bug for which it was created. It does seem though that we have an inadequate model of how to perform permission checks. In particular, the write flag bit in RTEs is context dependent: it can mean insert, update, or delete permission depending on the surrounding command. The problem the earlier bug report identified is really that when an RTE is copied from one query to another, the meaning of its write flag bit changes --- incorrectly --- if the new query is of a different type. I thought when making that patch that we could make an end-run around this problem by zeroing out the flag bit, but what we're now realizing is that that leaves us with no check at all in some scenarios (because the original query will be dropped completely when INSTEAD is specified). I begin to think that the only real solution is to change the RTE representation to identify the exact permission bits to be checked for each entry (say, replace the read and write booleans with a permission bitmask). Then a view reference specifying INSERT permission check could be copied into an UPDATE query without changing its permission semantics. This would be a fairly extensive change though. Does anyone see an easier way? Also, does anyone see a case where it would be correct for the checked permission to change when an RTE is copied to a query of a different type? regards, tom lane ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
[HACKERS] Connecting to Postgres
How do you connect to postgres if it is running on a different machine. I am looking for a telnet command in place of postmaster -D data ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED])
[HACKERS] Error with returning SETOF Record
Hi, I was wondering if a solution was ever found to the error: "wrong record type supplied in RETURN NEXT" when executing a function that returns the Record datatype? I have seen a couple of previous post from Tom Lane and others, but no real resolution. I am attempting to execute this code and I get that error: code CREATE FUNCTION tester(varchar) RETURNS SETOF record as'DECLAREft record; begin FOR ft IN SELECT * FROM visaapplicants LOOP RETURN NEXT ft; END LOOP;return null;end;' LANGUAGE 'plpgsql' VOLATILE; calling query select * from tester('a') as (c varchar); exact error ERROR: wrong record type supplied in RETURN NEXTCONTEXT: PL/pgSQL function "tester" line 6 at return next It was just a simple test statement because a larger one is producing the same error, and when I change return next to return it does not return any data even though there are 500 records. TIA Alex Erwin
Re: [HACKERS] Error with returning SETOF Record
A E [EMAIL PROTECTED] writes: CREATE FUNCTION tester(varchar) RETURNS SETOF record as' DECLARE ft record; begin FOR ft IN SELECT * FROM visaapplicants LOOP RETURN NEXT ft; END LOOP; return null; end;' LANGUAGE 'plpgsql' VOLATILE; calling query select * from tester('a') as (c varchar); exact error ERROR: wrong record type supplied in RETURN NEXT CONTEXT: PL/pgSQL function tester line 6 at return next That's pretty much what I'd expect, unless table visaapplicants contains only a single varchar column. The example works fine for me if I define visaapplicants that way. regards, tom lane ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [HACKERS] [GENERAL] Strange permission problem regarding pg_settings
Tom Lane wrote: Reverting the change will bring back the bug for which it was created. It does seem though that we have an inadequate model of how to perform permission checks. In particular, the write flag bit in RTEs is context dependent: it can mean insert, update, or delete permission depending on the surrounding command. Sorry if I'm being thick, but what of this? regression= insert into table1 values (1); NOTICE: relOid = 1245674 NOTICE: userid = 101 NOTICE: operation = CMD_INSERT NOTICE: relOid = 1245674 NOTICE: userid = 101 NOTICE: operation = CMD_UPDATE ERROR: table1: permission denied regression= select oid, relname from pg_class where relname like 'table%'; oid | relname -+- 1245674 | table1 1245676 | table2 (2 rows) Given how rules are supposed to work, the first check looks correct: INSERT on table1 checked as pleb, userid = 101 But the second check is incorrect, not because of the mode being checked, but because of the reloid and userid. The second check should be: UPDATE on table2 checked as postgres, userid = 1 So why doesn't the second rte refer to table2 and userid=1? Joe ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED])
Re: [HACKERS] Error with returning SETOF Record
I guess the question I have then is how do I return data from a select statement using the record datatype? This is only a test function I was trying to get info from, but my application is based on passing the table name to the function dynamically. How do I do this? The documentation is sketchy when it comes to the record datatype. TIA AlexTom Lane [EMAIL PROTECTED] wrote: A E <[EMAIL PROTECTED]>writes: CREATE FUNCTION tester(varchar) RETURNS SETOF record as' DECLARE ft record; begin FOR ft IN SELECT * FROM visaapplicants LOOP RETURN NEXT ft; END LOOP; return null; end;' LANGUAGE 'plpgsql' VOLATILE; select * from tester('a') as (c varchar); ERROR: wrong record type supplied in RETURN NEXT CONTEXT: PL/pgSQL function "tester" line 6 at return nextThat's pretty much what I'd expect, unless table visaapplicants containsonly a single varchar column. The example works fine for me if I definevisaapplicants that way.regards, tom lane---(end of broadcast)---TIP 9: the planner will ignore your desire to choose an in dex scan if yourjoining column's datatypes do not match
Re: [HACKERS] [GENERAL] Strange permission problem regarding pg_settings
Joe Conway [EMAIL PROTECTED] writes: Sorry if I'm being thick, but what of this? This is exactly what I'm talking about. The rtable for a query generated by a rule is the concatenation of the original query's rtable and the rule query's rtable. Therefore the RTE for table1 appears twice, once in the original INSERT query and once in the generated UPDATE query (even though the UPDATE query does not actually use that RTE in this case). This would be okay if the RTE's write permission flag were not context-dependent, but because it is, we have a problem. The patch I put into 7.3.3 assumed that we could just suppress permission checks on the copied RTEs, but if the original query is getting dropped due to INSTEAD, we really need to carry out those permission checks in the generated query --- there is no place else. So AFAICS we must make the permission checks non-context-dependent. regards, tom lane ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [HACKERS] [GENERAL] Strange permission problem regarding pg_settings
Tom Lane wrote: This is exactly what I'm talking about. The rtable for a query generated by a rule is the concatenation of the original query's rtable and the rule query's rtable. Therefore the RTE for table1 appears twice, once in the original INSERT query and once in the generated UPDATE query (even though the UPDATE query does not actually use that RTE in this case). This would be okay if the RTE's write permission flag were not context-dependent, but because it is, we have a problem. OK, that makes more sense now. But why isn't table2 also in the rule query's rtable? Joe ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED])
Re: [HACKERS] [GENERAL] Strange permission problem regarding pg_settings
Joe Conway [EMAIL PROTECTED] writes: OK, that makes more sense now. But why isn't table2 also in the rule query's rtable? It is, but you errored out before getting to it. regards, tom lane ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [HACKERS] Error with returning SETOF Record
A E wrote: I guess the question I have then is how do I return data from a select statement using the record datatype? This is only a test function I was trying to get info from, but my application is based on passing the table name to the function dynamically. How do I do this? The documentation is sketchy when it comes to the record datatype. You need to specify in your query the column definition that will actually be returned. Here's a simple example: create table t1 (f1 int, f2 text); insert into t1 values (1,'a'); insert into t1 values (2,'b'); create table t2 (f1 int, f2 float8); insert into t2 values (3, 3.14); insert into t2 values (4, 2.8); create or replace function getrec(text) returns setof record as ' DECLARE ft record; begin FOR ft IN EXECUTE ''SELECT * FROM '' || $1 LOOP RETURN NEXT ft; END LOOP; return; end; ' LANGUAGE 'plpgsql' VOLATILE; regression=# SELECT * FROM getrec('t1') AS (f1 int, f2 text); f1 | f2 + 1 | a 2 | b (2 rows) regression=# SELECT * FROM getrec('t2') AS (f1 int, f2 float8); f1 | f2 +-- 3 | 3.14 4 | 2.8 (2 rows) HTH, Joe ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
[HACKERS] Little mess in RPM RH ?
Hi all, I'm founding little messy the RPM condition for redhat: Inside the RH9.0 coesist the 7.4.0-0.3 and 7.4.0-0.5 versions looking on other RH directory version I found that actually 7.4.0-0.2 7.4.0-0.3 7.4.0-0.4 7.4.0-0.5 are existing. Inside the SRPMS directory is present only the 7.4.0-0.2 version! I'm able to put my hand on RH 8.0, RH 9.0, RHAS 2.1 and RHAS 3.0 and RH 7.3 systems, if you need some help let me know. Regards Gaetano Mendola ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [HACKERS] [GENERAL] Strange permission problem regarding pg_settings
Tom Lane wrote: Joe Conway [EMAIL PROTECTED] writes: OK, that makes more sense now. But why isn't table2 also in the rule query's rtable? It is, but you errored out before getting to it. The fog has finally started lifting, I think. Why wouldn't we force checkAsUser to the rule owner in the copied RTEs, similar to the rest of the rule query? It makes sense in that the rule query could possibly use the RTE (although as you pointed out it doesn't in this case), and therefore the permission check should be the same, no? Joe ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly