summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt
Commit message (Collapse)AuthorAgeFilesLines
* The cstring datatype can now be copied, passed around, etc. The typlenTom Lane2002-08-243-28/+51
| | | | | | | value '-2' is used to indicate a variable-width type whose width is computed as strlen(datum)+1. Everything that looks at typlen is updated except for array support, which Joe Conway is working on; at the moment it wouldn't work to try to create an array of cstring.
* Commit updated repeat() patch, from Neil ConwayBruce Momjian2002-08-221-3/+9
|
* This patch should fix the problem. Doesn't include my previous patchBruce Momjian2002-08-221-1/+11
| | | | | | | | | | | | | | | for repeat(). Again, somewhat off-the-cuff, so I might have missed something... test=# select lpad('xxxxx',1431655765,'yyyyyyyyyyyyyyyy'); ERROR: Requested length too large test=# select rpad('xxxxx',1431655765,'yyyyyyyyyyyyyyyy'); ERROR: Requested length too large (That's on a Unicode DB, haven't tested other encodings but AFAICT this fix should still work.) Neil Conway
* repeat() fix:Bruce Momjian2002-08-221-1/+5
| | | | | | | | | | | | | | | | > Neil Conway <neilc@samurai.com> writes: > > + /* Check for integer overflow */ > > + if (tlen / slen != count) > > + elog(ERROR, "Requested buffer is too large."); > > What about slen == 0? Good point -- that wouldn't cause incorrect results or a security problem, but it would reject input that we should really accept. Revised patch is attached. Neil Conway
* As suggested by Tom, this patch restricts the right-hand argument ofBruce Momjian2002-08-221-3/+3
| | | | | | | | | | | bytealike to TEXT. This leaves like_escape_bytea() without anything to do, but I left it in place in anticipation of the eventual bytea pattern selectivity functions. If there is agreement that this would be the best long term solution, I'll take it as a TODO for 7.4. Joe Conway
* Add:Bruce Momjian2002-08-221-138/+548
| | | | | | | | | | | replace(string, from, to) -- replaces all occurrences of "from" in "string" to "to" split(string, fldsep, column) -- splits "string" on "fldsep" and returns "column" number piece to_hex(int32_num) & to_hex(int64_num) -- takes integer number and returns as hex string Joe Conway
* Add a bunch of pseudo-types to replace the behavior formerly associatedTom Lane2002-08-225-72/+250
| | | | | | with OPAQUE, as per recent pghackers discussion. I still want to do some more work on the 'cstring' pseudo-type, but I'm going to commit the bulk of the changes now before the tree starts shifting under me ...
* Increase buffer size in cash_words(). Pure paranoia; I don't think theTom Lane2002-08-201-2/+2
| | | | | code is broken, but any small change in the output format might overrun the buffer with the old size.
* Allow pg_statistics to be reset by calling pg_stat_reset().Bruce Momjian2002-08-201-0/+12
| | | | Christopher Kings-Lynne
* Add current_database().Bruce Momjian2002-08-201-1/+18
| | | | | | | | | | | | | | | > Quick system function to pull out the current database. > > I've used this a number of times to allow stored procedures to find out > where they are. Especially useful for those that do logging or hit a > remote server. > > It's called current_database() to match with current_user(). It's also a necessity for an informational schema. The catalog (database) name is required in a number of places. Rod Taylor
* Make pg_dump output more portable and more pleasing to look at.Peter Eisentraut2002-08-181-6/+35
| | | | | | | | | | | | | | | | | The -n and -N options were removed. Quoting is now smart enough to supply quotes if and only if necessary. Numerical types are now printed without quotes, except in cases of special values such as NaN. Boolean values printed as true and false. Most string literals now do not escape whitespace characters (newlines, etc.) for portability. SET SESSION AUTHORIZATION argument is a string literal, to follow SQL. Made commands output by pg_dump use consistent spacing and indentation.
* Add lock file.Bruce Momjian2002-08-171-0/+146
|
* [ Newest version of patch applied.]Bruce Momjian2002-08-171-2/+2
| | | | | | | | | | | | | | | | | | This patch is an updated version of the lock listing patch. I've made the following changes: - write documentation - wrap the SRF in a view called 'pg_locks': all user-level access should be done through this view - re-diff against latest CVS One thing I chose not to do is adapt the SRF to use the anonymous composite type code from Joe Conway. I'll probably do that eventually, but I'm not really convinced it's a significantly cleaner way to bootstrap SRF builtins than the method this patch uses (of course, it has other uses...) Neil Conway
* Modify pg_dump to dump foreign-key constraints as constraints, not asTom Lane2002-08-161-1/+217
| | | | | | | sets of triggers. Also modify psql \d command to show foreign key constraints as such and hide the triggers. pg_get_constraintdef() function added to backend to support these. From Rod Taylor, code review and some editorialization by Tom Lane.
* Make domain types indexable. Rod Taylor & Tom Lane.Tom Lane2002-08-161-1/+5
|
* Tom Lane wrote:Bruce Momjian2002-08-151-1/+7
| | | | | | | | | | | | | | | | | > There's no longer a separate call to heap_storage_create in that routine > --- the right place to make the test is now in the storage_create > boolean parameter being passed to heap_create. A simple change, but > it passeth patch's understanding ... Thanks. Attached is a patch against cvs tip as of 8:30 PM PST or so. Turned out that even after fixing the failed hunks, there was a new spot in bufmgr.c which needed to be fixed (related to temp relations; RelationUpdateNumberOfBlocks). But thankfully the regression test code caught it :-) Joe Conway
* Make sure monetary, numeric, and time locale categories are set to C andPeter Eisentraut2002-08-091-29/+123
| | | | are only activated temporarily to read out formatting information.
* has_table_privilege spawns scions has_database_privilege, ↵Tom Lane2002-08-092-148/+871
| | | | | | | | | | | has_function_privilege, has_language_privilege, has_schema_privilege to let SQL queries test all the new privilege types in 7.3. Also, add functions pg_table_is_visible, pg_type_is_visible, pg_function_is_visible, pg_operator_is_visible, pg_opclass_is_visible to test whether objects contained in schemas are visible in the current search path. Do some minor cleanup to centralize accesses to pg_database, as well.
* Cause view/rule display to work as expected after rename of an underlyingTom Lane2002-08-081-39/+76
| | | | table or column, or of an output column of the view itself.
* Cause schema-qualified FROM items and schema-qualified variable referencesTom Lane2002-08-081-16/+104
| | | | | | to behave according to SQL92 (or according to my current understanding of same, anyway). Per pghackers discussion way back in March 2002: thread 'Do FROM items of different schemas conflict?'
* Restructure system-catalog index updating logic. Instead of havingTom Lane2002-08-051-8/+2
| | | | | | | | | hardwired lists of index names for each catalog, use the relcache's mechanism for caching lists of OIDs of indexes of any table. This reduces the common case of updating system catalog indexes to a single line, makes it much easier to add a new system index (in fact, you can now do so on-the-fly if you want to), and as a nice side benefit improves performance a little. Per recent pghackers discussion.
* Rename backend_pid to pg_backend_pid, move docs to monitoring section.Bruce Momjian2002-08-041-2/+2
|
* Add guard code to protect from buffer overruns on long date/time inputThomas G. Lockhart2002-08-046-322/+420
| | | | | | | | | | | | | | strings. Should go back in and look at doing this a bit more elegantly and (hopefully) cheaper. Probably not too bad anyway, but it seems a shame to scan the strings twice: once for length for this buffer overrun protection, and once to parse the line. Remove use of pow() in date/time handling; was already gone from everything *but* the time data types. Define macros for handling typmod manipulation for date/time types. Should be more robust than all of that brute-force inline code. Rename macros for masking and typmod manipulation to put TIMESTAMP_ or INTERVAL_ in front of the macro name, to reduce the possibility of name space collisions.
* Allow bit string constants without fully-specified length declaration.Thomas G. Lockhart2002-08-041-35/+98
| | | | | Implement conversion between 8-byte integers and bit strings. Similar to what is done for 4-byte integers.
* ALTER TABLE DROP COLUMN works. Patch by Christopher Kings-Lynne,Tom Lane2002-08-021-26/+3
| | | | | | | | | | code review by Tom Lane. Remaining issues: functions that take or return tuple types are likely to break if one drops (or adds!) a column in the table defining the type. Need to think about what to do here. Along the way: some code review for recent COPY changes; mark system columns attnotnull = true where appropriate, per discussion a month ago.
* Rename pid function to backend_pid().Bruce Momjian2002-07-311-2/+2
|
* Add function to access backend pid, pg_stat_get_backend_mypid.Bruce Momjian2002-07-311-0/+8
|
* This should fix a bug where a row that was updated orBruce Momjian2002-07-301-4/+243
| | | | | | | | | | | deleted that had another row inserted/updated to its old value during the same statement or other statements before the integrity check for noaction would incorrectly error. This could happen in deferred constraints or due to triggers or functions. It's effectively a reworking of the previous patch that did a not exists to instead do a separate check. Stephan Szabo
* Implement CREATE/DROP OPERATOR CLASS. Work still remains: need moreTom Lane2002-07-291-27/+53
| | | | | | | documentation (xindex.sgml should be rewritten), need to teach pg_dump about it, need to update contrib modules that currently build pg_opclass entries by hand. Original patch by Bill Studenmund, grammar adjustments and general update for 7.3 by Tom Lane.
* Remove unused system table columns:Peter Eisentraut2002-07-241-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | pg_language.lancompiler pg_operator.oprprec pg_operator.oprisleft pg_proc.proimplicit pg_proc.probyte_pct pg_proc.properbyte_cpu pg_proc.propercall_cpu pg_proc.prooutin_ratio pg_shadow.usetrace pg_type.typprtlen pg_type.typreceive pg_type.typsend Attempts to use the obsoleted attributes of pg_operator or pg_proc in the CREATE commands will be greeted by a warning. For pg_type, there is no warning (yet) because pg_dump scripts still contain these attributes. Also remove new but already obsolete spellings isVolatile, isStable, isImmutable in WITH clause. (Use new syntax instead.)
* oid is needed, it is added at the end of the struct (after the nullBruce Momjian2002-07-202-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bitmap, if present). Per Tom Lane's suggestion the information whether a tuple has an oid or not is carried in the tuple descriptor. For debugging reasons tdhasoid is of type char, not bool. There are predefined values for WITHOID, WITHOUTOID and UNDEFOID. This patch has been generated against a cvs snapshot from last week and I don't expect it to apply cleanly to current sources. While I post it here for public review, I'm working on a new version against a current snapshot. (There's been heavy activity recently; hope to catch up some day ...) This is a long patch; if it is too hard to swallow, I can provide it in smaller pieces: Part 1: Accessor macros Part 2: tdhasoid in TupDesc Part 3: Regression test Part 4: Parameter withoid to heap_addheader Part 5: Eliminate t_oid from HeapTupleHeader Part 2 is the most hairy part because of changes in the executor and even in the parser; the other parts are straightforward. Up to part 4 the patched postmaster stays binary compatible to databases created with an unpatched version. Part 5 is small (100 lines) and finally breaks compatibility. Manfred Koizar
* pg_cast table, and standards-compliant CREATE/DROP CAST commands, plusPeter Eisentraut2002-07-182-24/+24
| | | | | | | | | | | extension to create binary compatible casts. Includes dependency tracking as well. pg_proc.proimplicit is now defunct, but will be removed in a separate commit. pg_dump provides a migration path from the previous scheme to declare casts. Dumping binary compatible casts is currently impossible, though.
* Back out BETWEEN node patch, was causing initdb failure.Bruce Momjian2002-07-181-26/+1
|
* Finished the Between patch Christopher started.Bruce Momjian2002-07-181-1/+26
| | | | | | | | | | | | Implements between (symmetric / asymmetric) as a node. Executes the left or right expression once, makes a Const out of the resulting Datum and executes the >=, <= portions out of the Const sets. Of course, the parser does a fair amount of preparatory work for this to happen. Rod Taylor
* Oops, sometimes strtol isn't called in pg_atoi, so we do need that badpBruce Momjian2002-07-161-3/+3
| | | | check.
* Fix tid to in/out as unsigned.Bruce Momjian2002-07-162-7/+21
|
* Mark 'line' as 'not implemented' in SGML and psql \dT, per ThomasBruce Momjian2002-07-161-1/+3
| | | | Lockhart. initdb not forced.
* Implement the IS DISTINCT FROM operator per SQL99.Thomas G. Lockhart2002-07-041-1/+16
| | | | | | | | | | | | | | | | Reused the Expr node to hold DISTINCT which strongly resembles the existing OP info. Define DISTINCT_EXPR which strongly resembles the existing OPER_EXPR opType, but with handling for NULLs required by SQL99. We have explicit support for single-element DISTINCT comparisons all the way through to the executor. But, multi-element DISTINCTs are handled by expanding into a comparison tree in gram.y as is done for other row comparisons. Per discussions, it might be desirable to move this into one or more purpose-built nodes to be handled in the backend. Define the optional ROW keyword and token per SQL99. This allows single-element row constructs, which were formerly disallowed due to shift/reduce conflicts with parenthesized a_expr clauses. Define the SQL99 TREAT() function. Currently, use as a synonym for CAST().
* Remove Jan's copyright, with his approval.Bruce Momjian2002-06-211-2/+1
|
* Clean up some copyrights.Bruce Momjian2002-06-202-4/+4
|
* Update copyright to 2002.Bruce Momjian2002-06-2031-62/+62
|
* Here is a patch for Composite and Set returning function support. I madeBruce Momjian2002-06-201-8/+6
| | | | | | | two small changes to the API since last patch, which hopefully completes the decoupling of composite function support from SRF specific support. Joe Conway
* Merge ALTER GROUP ADD/DROP rules by creating add_drop action.Bruce Momjian2002-06-171-2/+1
|
* Patch for current_schemas to optionally include implicit ...Bruce Momjian2002-06-151-2/+2
| | | | | | | | Second cut attached. This one just adds a boolean option to the existing function to indicate that implicit schemas are to be included (or not). I remembered the docs as well this time :-) Dave Page
* The macaddr datatype understands most formats of MAC address, except 12Bruce Momjian2002-06-151-1/+3
| | | | | | | hex digits with no separators, eg 00AABBCCDDEE. This is easily remedied with the following patch (against 7.2.1): Mike Wyer
* Search the existing regular expression cache as a ring buffer.Thomas G. Lockhart2002-06-151-30/+26
| | | | | | | | | Will optimize the case for repeated calls for the same expression, which seems to be the most common case. Formerly, always searched from the first entry. May want to look at the least-recently-used algorithm to make sure it is identifying the right slots to reclaim. Seems silly to do math when it seems that we could simply use an incrementing counter...
* make namein multibyte awareTatsuo Ishii2002-06-131-9/+13
|
* Further tweaks to support display of sort keys in EXPLAIN --- initialTom Lane2002-06-131-24/+8
| | | | implementation didn't work for Sort nodes associated with Append plans.
* Implement SQL99 OVERLAY(). Allows substitution of a substring in a string.Thomas G. Lockhart2002-06-111-14/+85
| | | | | | | | | | | Implement SQL99 SIMILAR TO as a synonym for our existing operator "~". Implement SQL99 regular expression SUBSTRING(string FROM pat FOR escape). Extend the definition to make the FOR clause optional. Define textregexsubstr() to actually implement this feature. Update the regression test to include these new string features. All tests pass. Rename the regular expression support routines from "pg95_xxx" to "pg_xxx". Define CREATE CHARACTER SET in the parser per SQL99. No implementation yet.
* Katherine Ward wrote:Jan Wieck2002-06-114-28/+28
| | | | | | | | | | | | | | > Changes to avoid collisions with WIN32 & MFC names... > 1. Renamed: > a. PROC => PGPROC > b. GetUserName() => GetUserNameFromId() > c. GetCurrentTime() => GetCurrentDateTime() > d. IGNORE => IGNORE_DTF in include/utils/datetime.h & utils/adt/datetim > > 2. Added _P to some lex/yacc tokens: > CONST, CHAR, DELETE, FLOAT, GROUP, IN, OUT Jan