[HACKERS] ProcessUtilityHook DropStmt RenameStmt

2014-08-11 Thread geohas

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi!

I try to catch a DropStmt and convert it to a Rename Stmt, like petere's
pg_trashcan, but i don't like to create new schema. I only like to
rename the table in case of a drop table query.
Is this possible with something like:

ProcessUtility (Node * parsetree,
   const char *queryString,
   ParamListInfo params,
   bool isTopLevel,
   DestReceiver * dest, char *completionTag)

{
if (nodeTag(parsetree) == T_DropStmt)
{
 DropStmt *stmt = (DropStmt *) parsetree;
 if (stmt-removeType == OBJECT_TABLE)
{
 RenameStmt *newstmt = makeNode(RenameStmt);
newstmt-objectType = stmt-removeType;
newstmt-newname = new_name;
parsetree = (Node *) newstmt;
}
(*prev_ProcessUtility) (parsetree, queryString,context, params,
dest, completionTag);
}

regards

ge0has
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.22 (GNU/Linux)

iQEcBAEBAgAGBQJT6MfNAAoJEJFGMlQe7wR/RCQH/1KOwtCLDT2QVrGm/PKfIFGF
e6w+oOCUYz8v78s+uvI5Y5qEuUr2wqYuUhhV7UWXWBwKgLPkSvUTv04TWS9Ms6FJ
+Zn+yzqWUygdwDzKbKY3/qYreYAL6ZBv62ldjtApNUh1VHpPtZsPWtIe/485KB6v
W4xZt7PUAKOUlqTiQwaZok2rdYt0t7vWdVmw6qncUnlPGBpJM/XGGwDl4w5NCK23
Ls5ueLpe8gKoH1eMYG27FKo1rRARVBtB3zPkXmmfRZR+f1FUIkhiDkfm1AYhBJPy
FG0yExArvZjZLQIIEaenb8GzwjR04Ulaqej5CLPdOB0NomkN0aN0CKcSRT9SrME=
=Y3t4
-END PGP SIGNATURE-



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] How to use Makefile - pgxs without gcc -O2 ?

2014-07-08 Thread geohas

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

hi,

is there any hint to tell pgxs to compile with gcc -O0 (CFLAGS) ?

regards

geohas
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTvA4AAAoJEJFGMlQe7wR/6PAIAIy6619E9WpksRxaT+t132Py
+jsiIhuj0qfyRHglILmyQLITc1Y3MoTO0jjBfhspBZE/NdOMd2uqf+0+QMIBdy9L
vnM36quDUs5Zd0Ix8EWG75l9z4aeRRZG5Sh4pH8gGbOYwWPT9uefl7/4bvIeMD3c
0Zsmgt3nE6F5Yxptud+RQNf4ppOfh+46K0Y24WSXW5V99YuLaOfVJXbe0IyU9Zna
/Ib6UqRwKaBoHwqub3jVZTcCKk3CXigqeQ9dJffw0e+3uMOlajRLTQ2CDlZKg6I+
Pakzlwby6szFsMEG13S8e32QuQ/X3lCxPfl2Us+78R4vXpfKSdqvfdIMEtbWTLM=
=aUO6
-END PGP SIGNATURE-



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] How to use Makefile - pgxs without gcc -O2 ?

2014-07-08 Thread geohas

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Thank you Tom!

make CFLAGS=-O0  was it.

now gdb doesn't print Value optimized out.

regards


On 08/07/14 17:45, Tom Lane wrote:
 geohas li...@hasibether.at writes:
 is there any hint to tell pgxs to compile with gcc -O0 (CFLAGS) ?

 I tend to use

 make PROFILE=-O0

 which relies on knowing that PG's make rules append $(PROFILE) to CFLAGS.
 Alternatively you could just override CFLAGS:

 make CFLAGS=whatever

 but this requires knowing exactly what configure put into CFLAGS so
 that you don't remove any flags that you still want.

 regards, tom lane



-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTvBP3AAoJEJFGMlQe7wR/ACYIAJufplHygGUpKft8+S0W/Mpu
+tLX8bWpFd9Zg1fD1+gC0AglN6hSmiBc1TpSejOSruVUnFRoIAPbzDp+lSUpR4Hm
nC99Zjr71Qosinrwh3upLcN+CvM5jG+J5SLJfjTK1z5CLR0imudTQLXrNw8j0rFu
mgH5gKYa+/idxKnG1Hf8dzvdGIUOiRxDvX0F+FXgESedur6/voYgA6utdQBjHVLS
rfdNncWtcvswNhvhBfaZX30Nv9w+tiY/i+d/fR5mxU1D6RPDDy2JDIiQcX4ZstaS
1Rc4GYfH780TJxxp8whZ1cVgCcUC6G1cC23bvBfScuZn14+1qMsyHX/AjQRpugQ=
=lDtn
-END PGP SIGNATURE-



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] Does changing attribute order breaks something?

2014-06-30 Thread geohas

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi!

Are there any known issues when changing the attnums?

like :

airport=# update pg_attribute set attnum = 3 where attname = 'abc' and
attrelid = 18328;
UPDATE 1
airport=# update pg_attribute set attnum = 2 where attname = 'foo' and
attrelid = 18328;
UPDATE 1

Does something break or are there any other ideas to change the order of
columns?

regard

geohas
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTsZJMAAoJEJFGMlQe7wR/WL4H/32LaOBR5jKL4kvmCNKeItIF
g8EFPf4gJS9SleX0n6m7ctuKUkGQTkD6Ae7Azv0YyiMzJATgXlMHFUojj2JdyGar
yvPF2pxEzTwLPkST0cOuC68k/6KxZBvpy5FBaSFNAI1mExOTyNpO8H7lk6zWxw34
Iw8IWdayBqStdZ4HVMVTp6Vq6ReWpRKf/ekcbTIp9EKpimz0RsLafO3b0J1epv6t
w5VHCMLMuE8QtKuYaGkQ1+OwgKUiZQT/8vp4F4c5DIIYqpWWa4JjoNVmOA0leaVm
I1IFhNlo59jnPIRNR5/mIzezeA2LxZhuY4EOX6+zLy3iuja7KbdO6wXt1zedWBY=
=0KWv
-END PGP SIGNATURE-



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] Hooks Docu - list of hooks

2014-06-24 Thread geohas

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi to all!

I am searching for a documentation of hooks in PG, all i found was a
presentation in the wiki and some modules from 2ndQuadrant and petere on
github.  The last three weeks i was reading the source code to get some
information.

Is there a list of possible hooks, or maybe a little docu or overview?
Especially hooks to catch Insert, Update and Delete Stmts and SubQuerys.

It would help a lot to finish / write a log into Tables Module.



Please excuse my mail, if there was a similar question on the list, i
subscribed today and a simple search in the archive showd no results.

regards

geohas

PS: I've an excuse for my bad english - i'am austrian ;)
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTqVetAAoJEJFGMlQe7wR/ae0H/Rkt0G5d6kspgWhPyN/aIWIS
wTYKDdxDWt+EeyuCg7SWx/UxJLW22wnWKxmLjvfkT+/ibkCv5qmYRLMOh+cvH0O9
AimWP7fZX+VpYSfpmm/SuvuwUM3OQiM3iwU6MIpu4XfrulAD3F94/aafNp3D2jBK
Fz/J/Sjmr9LN/YBuE99i6asUJG669m4ISsmMpNwXPAh3wv+A3sN0dhvDCFJ11iCL
hIXqktMpm60iI5sIQUPUjgSTHFTj3aGuKtX3OCWPM4CHoaHwDNtq1klHeuiLSb3y
enjMW4tvTWtPw8DIkEgpatn8gsJvXVIjfsZPiTsp8HbN2evhkYxsgfV89R8usRU=
=vA51
-END PGP SIGNATURE-



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Hooks Docu - list of hooks

2014-06-24 Thread geohas

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 24/06/14 12:59, Abhijit Menon-Sen wrote:
 At 2014-06-24 12:49:17 +0200, li...@hasibether.at wrote:

 Is there a list of possible hooks, or maybe a little docu or overview?

 The best I found was git grep _hook_type and then read the code to
 understand when and why the hook was called.

 Especially hooks to catch Insert, Update and Delete Stmts and
 SubQuerys.

 It would help a lot to finish / write a log into Tables Module.

 Look at how pgaudit does it: https://github.com/2ndQuadrant/pgaudit
I already tried pgaudit ;), one of the best examples, it helped me much.


 The code has comments about how the various available hooks are used.
 (I was planning to implement a bgwriter that wrote log messages to a
 table, which sounds a bit like what you want to do.)
The module i'm thinking of, working on, is a bit inspired from pgaudit
and petere's pg_trashcan.
It should copy every created table in a shadow-schema with extra
columns for record on / record off and Userid (this is already working ;)).
In case of a drop statement it should rename the table in the shadow
schema XXX-droped-Date.

Now i am trying to catch the planned Stmts, ...
It should work without triggers - because the shadow schema should only
be visible for user postgres.

regards
geohas



 -- Abhijit



-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTqWQ4AAoJEJFGMlQe7wR/8CEIAJihWVGc//dDHGF9lDtMo3Ds
v1Xhd5U9n1tLL/Cx0/cqnslKctdfSCY2I/ptjNSDFO8U/YdUjNdPf4nYvxn0gjKR
n8VuC61BDr6qHFQvlJE7GLv2hs2GCxFM5dEgnV7foJjT18C/VgnSRFulJzxU87EZ
8uKG53+CM9ERDa5P9py9jyvrJJvIAXk9AAfevU9g+jimwK9OntwkC7ZfyVWEDwfr
x7LDyrzhge/EIco01pzJSimuVd0BPvTQ8V7XUTpy25xS+D8968wE8eRBaMWXH0b2
KR5lju+sz+SyVQKildcyExOEQWN3PgVmST5USAy9cAzPIuic+yR+qsa5H2VRTFI=
=ZYct
-END PGP SIGNATURE-



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers