[HACKERS] How to allocate a global variable (to implement virutal databases)
I would like to implement a row-level security for application-level-user (the user is not a postgresql user), I wish to restrict access to rows in diferent tables based on this application-level-user. My idea is to use rules to rewrite queries based on the contents of a global variable that is set with the application-level-userid, to this end I like to set the variabale at connection-time only, and aplied to all queris by the rewrite rules. I think I can write a c-function but I do not know the correct wayto allocate memory with session duration, maybe simply with alloc (o should I use palloc?).Or is there a solution I do not know about?Thanks.Atte.Juan Manuel Díaz Lara Blab-away for as little as 1¢/min. Make PC-to-Phone Calls using Yahoo! Messenger with Voice.
Re: [HACKERS] How to allocate a global variable (to implement virutal databases)
Thanks, but from the vail site "windows sorry"... I am working in windows.I was thinking in a simply implementation, with only global variables used with the rule system.I can write the c code for this.Tom Lane [EMAIL PROTECTED] wrote: Juan Manuel Diaz Lara <[EMAIL PROTECTED]>writes: I would like to implement a row-level security for application-level-user (the user is not a postgresql user),Have you looked at Veil?http://veil.projects.postgresql.org/regards, tom laneAtte.Juan Manuel Díaz Lara Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates.
[HACKERS] Problem compiling from cvs, mingw
I get the following error:gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -fno-strict-aliasing -I. -I../../../src/include -I./src/include/port/win32 -DEXEC_BACKEND "-I../../../src/include/port/win32" -DBUILDING_DLL -c -o bootparse.o bootparse.cbootparse.y:101:10: "b4_file_name" is not a valid filenamemake[3]: *** [bootparse.o] Error 1make[3]: Leaving directory `/pgsql/src/backend/bootstrap'make[2]: *** [bootstrap-recursive] Error 2make[2]: Leaving directory `/pgsql/src/backend'make[1]: *** [all] Error 2make[1]: Leaving directory `/pgsql/src'make: *** [all] Error 2 I have installed flex 2.5.4 y bison 2.1.The configure scripts pass correctly the tests for flex and bison.The problem seems to como from src/backend/bootstrap/bootparse.c with I suposse works with bison, but I do not know how. Thanks for any help. Atte.Juan Manuel Díaz Lara How low will we go? Check out Yahoo! Messengers low PC-to-Phone call rates.
[HACKERS] How to implement oracle like rownum(function or seudocolumn) ?
I need a rownum column, like Oracle. I have searched the mailing lists and I don't see a satisfactory solution, so I was wondering write a UDF to implement it, the requirements are:1. Need to preserve state between calls to the function (the rowcount). Maybe using a MemoryContext with a lifespan equal to the executing query. 2. It should be called every time a new row is produced. 3. And more important, need to be called in the right place when called from subquerys:Imagine one to man relationship between table A and tabla B. Then next querySELECT s.id, s.rownum FROM (SELECT a.id, rownum() AS rownum FROM a) s, b WHERE a.id = b.idIn this case, the rownum function should behave as if it was an aggregated function, where the subquery is evaluated first and the results joined with table b. I think that a UDF could be evaluated last by the planner (when producing the final resultset) so it won't give the intended result.I looking for a general solution, Any ideas? .Thanks. Atte.Juan Manuel Díaz Lara New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
[HACKERS] Rigth toolset to compile under mingw?
I have tried to compile 8.1.3 with mingw but I am receiving come errors, I do not know with versions are the correct one.Could some body tell me the right versions ? and url's to download from ? please. I searched the mainling lists but it is not clear.Thanks.Atte.Juan Manuel Díaz Lara New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
[HACKERS] Problem compiling with mingw
I run configure (no complains about bison o flex), after a few seconds I receive the next errors:make[4]: Leaving directory `/pgsql/src/backend/access/nbtree'make -C transam SUBSYS.omake[4]: Entering directory `/pgsql/src/backend/access/transam'make[4]: `SUBSYS.o' is up to date.make[4]: Leaving directory `/pgsql/src/backend/access/transam'make[3]: Leaving directory `/pgsql/src/backend/access'make -C bootstrap allmake[3]: Entering directory `/pgsql/src/backend/bootstrap'gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -fno-strict-aliasing -I. -I../../../src/include -I./src/include/port/win32 -DEXEC_BACKEND "-I../../../src/include/port/win32" -DBUILDING_DLL -c -o bootparse.o bootparse.cbootparse.y:101:10: "b4_file_name" is not a valid filenamemake[3]: *** [bootparse.o] Error 1make[3]: Leaving directory `/pgsql/src/backend/bootstrap'make[2]: *** [bootstrap-recursive] Error 2make[2]: Leaving directory `/pgsql/src/backend'make[1]: *** [all] Error 2make[1]: Leaving directory `/pgsql/src'make: *** [all] Error 2My enviroment, installed in that order:MSYS-1.0.8.exe -- d:\msys inGW-3.1.0-1.exe -- d:\msys\mingw msysDTK-1.0.1.exe - d:\msys bison-2.1.exe -- d:\gnuwin32 flex-2.5.4a-1.exe -- d:\gnuwin32fstab -- #Win32_PathMount_Point#c:/mingw/mingw#c:/ActiveState/perl/perld:/gnuwin32/gnuwin32 profile --- ... if [ $MSYSTEM == MINGW32 ]; then export PATH=".:/usr/local/bin:/mingw/bin:/bin:/gnuwin32/bin:$PATH"else export PATH=".:/usr/local/bin:/bin:/mingw/bin:/gnuwin32/bin:$PATH"fi ...S.O. : Windows 2003 serverCan any body help ? Thanks in advance. Atte.Juan Manuel Díaz Lara New Yahoo! Messenger with Voice. Call regular phones from your PC for low, low rates.
[HACKERS] Login/logout
Hello all I want to register in an audit table the date and time of the login/logout of a database user. I have been looking for some function in the code but I didn't find something like that. Can you give me some ideas to implement it?. I'm ready to program if it is necessary. Thanks in advance, regards Juan P. Espino ---(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] Login/logout
Thanks for the quick response. Yes I want to retrieve the login/logout info, but I want to insert this info in a table that I use as an audit table. Regards Juan P. Espino On 6/18/05, Michael Fuhr [EMAIL PROTECTED] wrote: On Sat, Jun 18, 2005 at 11:11:31AM -0500, Juan Pablo Espino wrote: I want to register in an audit table the date and time of the login/logout of a database user. I have been looking for some function in the code but I didn't find something like that. Are you interested in logging to a table specifically, or are you just trying to get the login/logout info? If the latter, then you can use log_connections and log_disconnections (the second of which is available in 8.0 and later). http://www.postgresql.org/docs/8.0/static/runtime-config.html#RUNTIME-CONFIG-LOGGING-WHAT -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(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] Login/logout
Hi, thanks for the response. On 6/18/05, Rod Taylor [EMAIL PROTECTED] wrote: On Sat, 2005-06-18 at 11:46 -0500, Juan Pablo Espino wrote: Thanks for the quick response. Yes I want to retrieve the login/logout info, but I want to insert this info in a table that I use as an audit table. Regards I suggest putting together a short script to scan the logs periodically and add the new entries to your table. It sounds to me good in order to resolve my problem. Nevertheless I think that it would be very useful to have a function that does something like select login() and gives back to the date and time of login, or that we can retrieve that info from the system catalogs. Regards, Juan P. Espino ---(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
[HACKERS] C array from SQL array?
Hello hackers At the moment I need to pass from a SQL array to a C array. I have the following table: CREATE TABLE emps ( name text, array int4[] ) For example, array have this values: {4000,1,0,0} I wrote this function for test in order to see something that could help me: extern Datum vector(PG_FUNCTION_ARGS); PG_FUNCTION_INFO_V1(vector); Datum vector(PG_FUNCTION_ARGS) { text*table_text = PG_GETARG_TEXT_P(0); TupleDesc tupdesc; boolisnull; char*table_char, *type, *cmd; int n1, ret; table_char = text_2_char(table_text); /* pass text to c string */ cmd = (char *) palloc(14 + strlen(table_char) + 1); tupdesc = (TupleDesc) RelationNameGetTupleDesc(table_char); sprintf(cmd, select * from %s, table_char); SPI_connect(); type = SPI_gettype(tupdesc, 2); /* to obtain the c data type of the sql array?? */ ret = SPI_exec(cmd, 0); /* for this test I take only the first table row */ n1 = DatumGetInt32(SPI_getbinval(SPI_tuptable-vals[0], SPI_tuptable-tupdesc, 2, isnull)); SPI_finish(); elog(INFO, The data type of the column no. 2 is %s and its value is %d, type, n1); return PointerGetDatum(ret); } Then, the result of the select vector('emps'); was INFO: The data type of the column no. 2 is _int4 and its value is 137606808 I wanted that n1 collects the data of the SQL array. I really appreciate any suggestions, thanks in advance, regards. Juan P. Espino PS. I ignore if the term I'm using SQL array is correct. ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
[HACKERS] Returning the name of a primary key
Hello all I need to write a function that retrieve the name of at least one table primary key, if it exists. The only argument passed to the function is the table name. I have thought something like this: char * give_pkey(char * table_char) TupleDesc tupdesc; Form_pg_attribute att; Form_pg_index ind; int i, c=0, temp=-1; tupdesc = (TupleDesc) RelationNameGetTupleDesc(tabla_char); ind = something that idicates which table is for (i=0; i(tupdesc-natts); i++) { att = tupdesc-attrs[i]; c = c + 1; /* Something that can compare each attribute to determine if it is a primary key ?*/ if ((ind-indisprimary) (temp=-1)) { temp = c; att = tupdesc-attrs[temp]; } } return pstrdup(NameStr(att-attname)); } Sorry, I don't have much experience in c programming, thanks in advance for any suggestions, regards, Juan P. Espino ---(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
[HACKERS] Understanding Rule System
Hello all I have been studying the rule system in Postgres. I understand that the original query tree is the input at the rewrite, and then this query tree is modified by the rewrite in case that there is a rule. SQL query Parser Rewrite Planner Executor Query New Query treetree I would like to know how the rewrite detects that a rule in a table exists, and if it possible you indicate me where in the source code it's implemented. Any comments are welcome, thanks in advance. Juan P. Espino ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
[HACKERS] Developer Community
Hello, My name is Juan, and I am interested in being a PostgreSQL Developer. I would like to contribute with items in the TODO list. I am new to the list, and would like to know if you have reservations or beliefs applicated to the members of the developer community, so if I can enter to it or I can be rejected by some topic or reason. If you need my CV, I have no problem to post it or send it to the appropiate person. Thank you very much. Regards,-- Juan Jose Costello LevienE-Mail: [EMAIL PROTECTED]Web: http://jcostello.ath.cx
Re: [HACKERS] Developer Community
Jim, So I interpret that simply proposing work and doing it are all the requirements needed. Thank you. Regards, -- Juan Jose Costello Levien E-Mail: [EMAIL PROTECTED] Web: http://jcostello.ath.cxOn 4/27/05, Jim C. Nasby [EMAIL PROTECTED] wrote:See http://www.postgresql.org/docs/faqs.FAQ_DEV.html; esp. items1.1-1.18.On Wed, Apr 27, 2005 at 08:35:10PM -0300, Juan Jose Costello Levien wrote: Hello, My name is Juan, and I am interested in being a PostgreSQL Developer. I would like to contribute with items in the TODO list. I am new to the list, and would like to know if you have reservations or beliefs applicated to the members of the developer community, so if I can enter to it or I can be rejected by some topic or reason. If you need my CV, I have no problem to post it or send it to the appropiate person. Thank you very much. Regards, -- Juan Jose Costello Levien E-Mail: [EMAIL PROTECTED] Web: http://jcostello.ath.cx--Jim C. Nasby, Database Consultant [EMAIL PROTECTED]Give your computer some brain candy! www.distributed.net Team #1828Windows: Where do you want to go today? Linux: Where do you want to go tomorrow?FreeBSD: Are you guys coming, or what?-- Juan Jose Costello LevienE-Mail: [EMAIL PROTECTED]Web: http://jcostello.ath.cx
[HACKERS] Case Sensitivity
Is there a way to set case sensitivity on? Thanks in advance juan
Re: [HACKERS] Another history question
Thanks for the explanation. Then, Can I say that PostgreSQL and Informix are cousins? On Tue, 22 Mar 2005 17:36:28 -0500, Tom Lane [EMAIL PROTECTED] wrote: Juan Pablo Espino [EMAIL PROTECTED] writes: My question is if the architecture of postgreSQL were inherited of postgres original project or postgreSQL were developed completely with a new concept. Thanks in advance. There hasn't been any fundamental rearchitecting since Berkeley days. For instance, look at Postgres 4.2 --- those sources are available on the net, and if you compare them to current CVS you'll find plenty that's recognizably the same code. regards, tom lane ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
[HACKERS] Another history question
I know that postgres was a project directed by Michael Stonebraker in Berkeley (1986-1994) and that soon Jolly Chen and Andrew Yu did postgres95. I understand that the main change in postgres95 was to implement SQL instead of POSTQUEL. Then after the appearance of postgres95 postgreSQL 6.0 arises. And what came later it is well-known history. My question is if the architecture of postgreSQL were inherited of postgres original project or postgreSQL were developed completely with a new concept. Thanks in advance. ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
[HACKERS]
set pgsql-hackers nomail ---(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]
Sorry it was for [EMAIL PROTECTED] On Thu, 17 Mar 2005 18:08:03 -0500, Juan Pablo Espino [EMAIL PROTECTED] wrote: set pgsql-hackers nomail ---(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 ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED])
[HACKERS] Label Security
Hello All, I'm new in postgres development, but I really interested in the development of label security for postgres. Label security provides mandatory acces control to the records in a table, like Oracle Label Security, and basically this is my intention to do. Well, I want to know if someone has working in a similar way and your opinion about my comment. Thanks a lot and sorry for my not very well english, Juan Espino
[HACKERS] segment default
hi. Please help me. I compiled and install pgadmin 3 version 1.0.2 with wxGTK 2.4.2_r1 and when i tried to connect to any server this send a beatiful error Segmentation default o something these. My distribution is gentoo 2004.2 I don't know how resolve this if you can tell me how i do it. Sorry for my english but only spoke spanish -- L.I. JUAN PATRICIO FLORES HERNANDEZ Desarrollador Departamento de Tecnologias de la Informacion EDICIONES TRATADOS Y EQUIPOS S.A. DE C.V. ETESA Vista Hermosa No. 100 Col. Lomas del Estadio Jalapa, Veracruz CP 91090 Tel:+52 228 841 7000 ext 2217, 2330 +52 228 841 7007 Fax:+52 228 841 7000 ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send unregister YourEmailAddressHere to [EMAIL PROTECTED])
[HACKERS] Problem with postgres's date
How is posible show the date in european format. By defalut it's ISO. I can show with SET datestyle=postgres but is validate from one sesion only. Thanks ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl
[HACKERS] Error: files pg_psort.*
What is this file? what can I do? One of this file is of 2.6 Bbytes the DB is of 50 Mb Is urgent. Thanks you. ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])