summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/misc.c
AgeCommit message (Collapse)Author
2013-02-21Move relpath() to libpgcommonAlvaro Herrera
This enables non-backend code, such as pg_xlogdump, to use it easily. The previous location, in src/backend/catalog/catalog.c, made that essentially impossible because that file depends on many backend-only facilities; so this needs to live separately.
2013-01-01Update copyrights for 2013Bruce Momjian
Fully update git head, and update back branches in ./COPYRIGHT and legal.sgml files.
2012-12-08Support automatically-updatable views.Tom Lane
This patch makes "simple" views automatically updatable, without the need to create either INSTEAD OF triggers or INSTEAD rules. "Simple" views are those classified as updatable according to SQL-92 rules. The rewriter transforms INSERT/UPDATE/DELETE commands on such views directly into an equivalent command on the underlying table, which will generally have noticeably better performance than is possible with either triggers or user-written rules. A view that has INSTEAD OF triggers or INSTEAD rules continues to operate the same as before. For the moment, security_barrier views are not considered simple. Also, we do not support WITH CHECK OPTION. These features may be added in future. Dean Rasheed, reviewed by Amit Kapila
2012-09-27Have pg_terminate/cancel_backend not ERROR on non-existent processesAlvaro Herrera
This worked fine for superusers, but not for ordinary users trying to cancel their own processes. Tweak the order the checks are done in so that we correctly return SIGNAL_BACKEND_ERROR (which current callers know to ignore without erroring out) so that an ordinary user can loop through a resultset without fearing that a process might exit in the middle of said looping -- causing the remaining processes to go unsignalled. Incidentally, the last in-core caller of IsBackendPid() is now gone. However, the function is exported and must remain in place, because there are plenty of callers in external modules. Author: Josh Kupershmidt Reviewed by Noah Misch
2012-08-07Fix redundant wordingAlvaro Herrera
2012-06-26Allow pg_terminate_backend() to be used on backends with matching role.Robert Haas
A similar change was made previously for pg_cancel_backend, so now it all matches again. Dan Farina, reviewed by Fujii Masao, Noah Misch, and Jeff Davis, with slight kibitzing on the doc changes by me.
2012-06-10Run pgindent on 9.2 source tree in preparation for first 9.3Bruce Momjian
commit-fest.
2012-04-10Make pg_tablespace_location(0) return the database's default tablespace.Tom Lane
This definition is convenient when applying the function to the reltablespace column of pg_class, since that's what zero means there; and it doesn't interfere with any other plausible use of the function. Per gripe from Bruce Momjian.
2012-03-02Add COLLATION FOR expressionPeter Eisentraut
reviewed by Jaime Casanova
2012-01-15Allow a user to kill his own queries using pg_cancel_backend()Magnus Hagander
Allows a user to use pg_cancel_queries() to cancel queries in other backends if they are running under the same role. pg_terminate_backend() still requires superuser permissoins. Short patch, many authors working on the bikeshed: Magnus Hagander, Josh Kupershmidt, Edward Muller, Greg Smith.
2012-01-01Update copyright notices for year 2012.Bruce Momjian
2011-12-07Fix corner cases in readlink() usage.Tom Lane
Make sure all calls are protected by HAVE_READLINK, and get the buffer overflow tests right. Be a bit more paranoid about string length in _tarWriteHeader(), too.
2011-12-07Better error reporting if the link target is too longMagnus Hagander
This situation won't set errno, so using %m will give an incorrect error message.
2011-12-07Remove spclocation field from pg_tablespaceMagnus Hagander
Instead, add a function pg_tablespace_location(oid) used to return the same information, and do this by reading the symbolic link. Doing it this way makes it possible to relocate a tablespace when the database is down by simply changing the symbolic link.
2011-09-09Move Timestamp/Interval typedefs and basic macros into datatype/timestamp.h.Tom Lane
As per my recent proposal, this refactors things so that these typedefs and macros are available in a header that can be included in frontend-ish code. I also changed various headers that were undesirably including utils/timestamp.h to include datatype/timestamp.h instead. Unsurprisingly, this showed that half the system was getting utils/timestamp.h by way of xlog.h. No actual code changes here, just header refactoring.
2011-09-01Remove unnecessary #include references, per pgrminclude script.Bruce Momjian
2011-01-01Stamp copyrights for year 2011.Bruce Momjian
2010-09-20Remove cvs keywords from all files.Magnus Hagander
2010-02-26pgindent run for 9.0Bruce Momjian
2010-01-12Please tablespace directories in their own subdirectory so pg_migratorBruce Momjian
can upgrade clusters without renaming the tablespace directories. New directory structure format is, e.g.: $PGDATA/pg_tblspc/20981/PG_8.5_201001061/719849/83292814
2010-01-02Update copyright for the year 2010.Bruce Momjian
2009-07-14Tweak the core scanner so that it can be used by plpgsql too.Tom Lane
Changes: Pass in the keyword lookup array instead of having it be hardwired. (This incidentally allows elimination of some duplicate coding in ecpg.) Re-order the token declarations in gram.y so that non-keyword tokens have numbers that won't change when keywords are added or removed. Add ".." and ":=" to the set of tokens recognized by scan.l. (Since these combinations are nowhere legal in core SQL, this does not change anything except the precise wording of the error you get when you write this.)
2009-06-118.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef listBruce Momjian
provided by Andrew.
2009-01-08Revert current_query() change to use debug_query_string again; add comment.Bruce Momjian
2009-01-07Have current_query() use ActivePortal->sourceText rather thanBruce Momjian
debug_query_string; this allows current_query() to be more accurate; docs updated; per idea from Tom
2009-01-07Add comment that it is difficult to access the more accurateBruce Momjian
'query_string' from current_query().
2009-01-01Update copyright for 2009.Bruce Momjian
2008-12-05Better descriptions in pg_get_keywords(), consistent with the documentationPeter Eisentraut
appendix on key words. catdesc was originally intended as computer-readable, but since we ended up adding catcode, we can have more elaborate descriptions.
2008-11-03Add pg_typeof() function.Tom Lane
Brendan Jurd
2008-10-05Remove obsolete internal functions istrue, isfalse, isnottrue, isnotfalse,Peter Eisentraut
nullvalue, nonvalue. A long time ago, these were used to implement the SQL constructs IS TRUE, etc.
2008-07-03Add a function pg_get_keywords() to let clients find out the set of keywordsTom Lane
known to the SQL parser. Dave Page
2008-04-17Re-enable pg_terminate_backend() using SIGTERM. SIGTERM testing stillBruce Momjian
needed.
2008-04-15Revert addition of pg_terminate_backend() because of race conditions.Bruce Momjian
2008-04-15Add pg_terminate_backend() to allow terminating only a single session.Bruce Momjian
2008-04-04Implement current_query(), that shows the currently executing query.Bruce Momjian
At the same time remove dblink/dblink_current_query() as it is no longer necessary *BACKWARD COMPATIBILITY ISSUE* for dblink Tomas Doran
2008-01-01Update copyrights in source tree to 2008.Bruce Momjian
2007-08-19Provide for logfiles in machine readable CSV format. In consequence, renameAndrew Dunstan
redirect_stderr to logging_collector. Original patch from Arul Shaji, subsequently modified by Greg Smith, and then heavily modified by me.
2007-01-05Update CVS HEAD for 2007 copyright. Back branches are typically notBruce Momjian
back-stamped for this.
2006-11-21On systems that have setsid(2) (which should be just about everything exceptTom Lane
Windows), arrange for each postmaster child process to be its own process group leader, and deliver signals SIGINT, SIGTERM, SIGQUIT to the whole process group not only the direct child process. This provides saner behavior for archive and recovery scripts; in particular, it's possible to shut down a warm-standby recovery server using "pg_ctl stop -m immediate", since delivery of SIGQUIT to the startup subprocess will result in killing the waiting recovery_command. Also, this makes Query Cancel and statement_timeout apply to scripts being run from backends via system(). (There is no support in the core backend for that, but it's widely done using untrusted PLs.) Per gripe from Stephen Harris and subsequent discussion.
2006-10-04pgindent run for 8.2.Bruce Momjian
2006-07-14Remove 576 references of include files that were not needed.Bruce Momjian
2006-07-13Allow include files to compile own their own.Bruce Momjian
Strip unused include files out unused include files, and add needed includes to C files. The next step is to remove unused include files in C files.
2006-03-05Update copyright for 2006. Update scripts.Bruce Momjian
2006-01-11Create a standard function pg_sleep() to sleep for a specified amount of time.Tom Lane
Replace the former ad-hoc implementation used in the regression tests. Joachim Wieland
2005-10-15Standard pgindent run for 8.1.Bruce Momjian
2005-09-16Rename pg_complete_relation_size() to pg_total_relation_size(), for theNeil Conway
sake of brevity and clarity. Make pg_reload_conf(), pg_rotate_logfile(), and pg_cancel_backend() return a boolean rather than an integer to indicate success or failure. Along the way, make some minor cleanups to dbsize.c -- in particular, use elog() rather than ereport() for "shouldn't happen" error conditions, and remove some of the more flagrant violations of the Postgres indentation conventions. Catalog version bumped.
2005-08-12Code & docs review for server instrumentation patch. File timestampsTom Lane
should surely be timestamptz not timestamp; fix some but not all of the holes in check_and_make_absolute(); other minor cleanup. Also put in the missed catversion bump.
2005-08-12Add files to do read I/O on the cluster directory:Bruce Momjian
pg_stat_file() pg_read_file() pg_ls_dir() pg_reload_conf() pg_rotate_logfile() Dave Page Andreas Pflug
2005-07-04Arrange for the postmaster (and standalone backends, initdb, etc) toTom Lane
chdir into PGDATA and subsequently use relative paths instead of absolute paths to access all files under PGDATA. This seems to give a small performance improvement, and it should make the system more robust against naive DBAs doing things like moving a database directory that has a live postmaster in it. Per recent discussion.
2005-06-19Simplify uses of readdir() by creating a function ReadDir() thatTom Lane
includes error checking and an appropriate ereport(ERROR) message. This gets rid of rather tedious and error-prone manipulation of errno, as well as a Windows-specific bug workaround, at more than a dozen call sites. After an idea in a recent patch by Heikki Linnakangas.