PostgreSQL function data types -


how can names , data types of variables usedin in postgresql functions? going through prosrc column in pg_proc 1 way. there better 1 - view stores information in format can queried/filtered? postgresql version 9.0.

no, there no in-built way in postgresql this. function body stored text string without parsing out components. can - - parse variable names , data types out, requires serious parsing.

for pl/pgsql:

  1. read first word (i.e. first term separated white-space next term); if declare read on until word begin.
  2. read next word, name of variable.
  3. read until comma , (separating 1 variable another) or word begin (end of variables), ignore commas inside parentheses () these associated initialization of variable or data type modifier (such numeric(8, 2)). data type, of it's modifiers , initialization.
  4. from text read in previous step, extract :=. before data type , modifiers, after initial value.
  5. repeat step 2 until encounter word begin.

there may nested blocks in single procedure, you'd have repeat procedure every block in body.

for other languages pl/perl, pl/tcl , pl/python you'd have parse variables according grammar. , there additional modules procedural languages, pl/r or pl/sh, yet again different grammar.

this not done simple reg_exp in query, require more advanced logical processing.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -