mreithub / pg_recall

Simple PostgreSQL extension that keeps track of changes to certain tables
Other
53 stars 1 forks source link

Use '%s' as `format()` placeholder for regclass items #18

Closed mreithub closed 8 years ago

mreithub commented 8 years ago

Right now, I'm using %I.%I for table names in dynamic queries (EXECUTE format(...)). But PostgreSQL's regclass to string casts are safe, i.e. they automatically escape spaces and other unsafe characters. Therefore format()'s %s placeholder can be used.

The advantage of this (other than its readability) is that we won't need to resolve the schema and table names ourselves every single time.