summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt
Commit message (Collapse)AuthorAgeFilesLines
* O.K. -Bruce Momjian2000-09-121-20/+17
| | | | | | | | | | | | | | | | | | | Here's the multibyte aware version of my patch to fix the truncation of the rulename autogenerated during a CREATE VIEW. I've modified all the places in the backend that want to construct the rulename to use the MakeRetrieveViewRuleName(), where I put the #ifdef MULTIBYTE, so that's the only place that knows how to construct a view rulename. Except pg_dump, where I replicated the code, since it's a standalone binary. The only effect the enduser will see is that views with names len(name) > NAMEDATALEN-4 will fail to be created, if the derived rulename clases with an existing rule: i.e. the user is trying to create two views with long names whose first difference is past NAMEDATALEN-4 (but before NAMEDATALEN: that'll error out after the viewname truncation.) In no case will the user get left with a table without a view rule, as the current code does. Ross Reedstrom
* Added functionsJan Wieck2000-09-052-2/+293
| | | | | | | | | | | quote_ident(text) returns text quote_literal(text) returns text These are handy to build up properly quoted query strings for the new PL/pgSQL EXECUTE functionality to submit dynamic DDL statements. Jan
* Fix relative path references so that make knowns which dependencies referPeter Eisentraut2000-08-311-5/+2
| | | | | to one another. Sort out builddir vs srcdir variable namings. Remove some now obsoleted make variables.
* * to_char:Bruce Momjian2000-08-293-59/+151
| | | | | | | | | | | | | | | | | | | | | | | - full support for IW (ISO week) and vice versa conversion for IW too (the to_char 'week' support is now complete and I hope correct). Thomas, I use for IW code from timestamp.c, for this I create separate function date2isoweek() from original 'case DTK_WEEK:' code in the timestamp_part(). I mean will better use one code for same feature in date_part() and in to_char(). The isoweek2date() is added to timestamp.c too. Right? IMHO in 7.1 will all to_char's features complete. It is cca 41 templates for date/time and cca 21 for numbers. * to_ascii: - gcc, is it correct now? :-) In the patch is documentation for to_char's IW and for to_ascii(). Karel
* Tired of seeing these warnings ...Tom Lane2000-08-261-2/+5
|
* Rename BITSPERBYTE to BITS_PER_BYTE to avoid conflict with <values.h>Tom Lane2000-08-262-26/+26
| | | | on some platforms.
* Avoid creating a TOAST table if we can prove that the maximum tupleTom Lane2000-08-251-1/+49
| | | | | | | length is < TOAST_TUPLE_THRESHOLD, even with toastable column types present. For example, CREATE TABLE foo (f1 int, f2 varchar(100)) does not require a toast table, even though varchar is a toastable type.
* SQL-language functions are now callable in ordinary fmgr contexts ...Tom Lane2000-08-241-17/+79
| | | | | | for example, an SQL function can be used in a functional index. (I make no promises about speed, but it'll work ;-).) Clean up and simplify handling of functions returning sets.
* Add functions to convert to and from text, and to truncate to MAC OUI.Thomas G. Lockhart2000-08-231-156/+69
| | | | | Remove hardcoded macaddr_manuf(), which had really old, obsolete info. Replace this with some contrib/mac/ code to maniag OUI info from IEEE.
* Add multibyte support for both LIKE and ILIKETatsuo Ishii2000-08-221-239/+100
| | | | Eliminate up-to-4-times memory allocation problem
* Fix format_type() to display correct lengths for BIT/BIT VARYING.Tom Lane2000-08-211-105/+121
| | | | | Also, make it depend on type OIDs rather than type names for more consistency with rest of backend.
* First pass at integrating BIT and BIT VARYING code from Adriaan Joubert.Tom Lane2000-08-211-451/+607
| | | | | | | Update functions to new-style fmgr, make BIT and VARBIT be binary- equivalent, add entries to allow these types to be btree indexed, correct a few bugs. BIT/VARBIT are now toastable, too. NOTE: initdb forced due to catalog updates.
* Fix ruleutils to produce correct output for array assignment, suchTom Lane2000-08-121-4/+50
| | | | as UPDATE foo SET arr[3] = 42.
* Reimplement MULTIBYTE support (oops). Not tested, but it does compile.Thomas G. Lockhart2000-08-091-121/+457
|
* Remove 'func_tlist' from Func expression nodes, likewise 'param_tlist'Tom Lane2000-08-081-1/+27
| | | | | | | | from Param nodes, per discussion a few days ago on pghackers. Add new expression node type FieldSelect that implements the functionality where it's actually needed. Clean up some other unused fields in Func nodes as well. NOTE: initdb forced due to change in stored expression trees for rules.
* TOAST mop-up work: update comments for tuple-size-related symbols suchTom Lane2000-08-071-3/+3
| | | | | | | as MaxHeapAttributeNumber. Increase MaxAttrSize to something more reasonable (given what it's used for, namely checking char(n) declarations, I didn't make it the full 1G that it could theoretically be --- 10Mb seemed a more reasonable number). Improve calculation of MaxTupleSize.
* Clean up code to remove the explicit backslash cruft.Thomas G. Lockhart2000-08-071-102/+83
| | | | | If the backslash default is still wanted, just pass a backslash to MatchText() for the two-parameter callable routines.
* Clean up bogosities in use of random(3) and srandom(3) --- do not assumeTom Lane2000-08-072-9/+11
| | | | | | | that RAND_MAX applies to them, since it doesn't. Instead add a config.h parameter MAX_RANDOM_VALUE. This is currently set at 2^31-1 but could be auto-configured if that ever proves necessary. Also fix some outright bugs like calling srand() where srandom() is appropriate.
* Implement LIKE/ESCAPE. Change parser to use like()/notlike()Thomas G. Lockhart2000-08-061-114/+356
| | | | | | | | | | | | | | | | | | | | rather than the "~~" operator; this made it easy to add ESCAPE features. Implement ILIKE, NOT ILIKE, and the ESCAPE clause for them. afaict this is not MultiByte clean, but lots of other stuff isn't either. Fix up underlying support code for LIKE/NOT LIKE. Things should be faster and does not require internal string copying. Update regression test to add explicit checks for LIKE/NOT LIKE/ILIKE/NOT ILIKE. Remove colon and semi-colon operators as threatened in 7.0. Implement SQL99 COMMIT/AND NO CHAIN. Throw elog(ERROR) on COMMIT/AND CHAIN per spec since we don't yet support it. Implement SQL99 CREATE/DROP SCHEMA as equivalent to CREATE DATABASE. This is only a stopgap or demo since schemas will have another implementation soon. Remove a few unused production rules to get rid of warnings which crept in on the last commit. Fix up tabbing in some places by removing embedded spaces.
* > I had to back out the patch. It only compiles with multi-byte enabled.Bruce Momjian2000-08-052-2/+204
| | | | | | | | | | | | | | Ooops, I forget... here it is again. > > > If encoding is not supported returns ERROR. and if multibyte not enabled too.... Thanks. Karel ~
* Back out to_ascii patch from Karel.Bruce Momjian2000-08-042-162/+2
|
* Add missing files from Karel, tip from Jan.Bruce Momjian2000-08-041-0/+159
|
* to_ascii( text )Bruce Momjian2000-08-041-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - encode 'text' from database encoding to ASCII to_ascii('\256\341k') to_ascii( text, int4 ) - encode 'text' from 'int4' encoding to ASCII to_ascii('\256\341k', 8) to_ascii( text, name ) - encode 'text' from 'name' encoding to ASCII to_ascii('\256\341k', 'LATIN2') Now is supported LATIN1, LATIN2, WIN1250. For other character sets I haven't good resources. Add new encoding is easy... If encoding is not supported returns ERROR. Note --- not exists total corect conversion to ASCII, this function try convert chars those is _probably_ interpret-able in ASCII for others use ' '. But for example for all Czech characters it is sufficient ... hmm Chinese / JAP and other complicated langs have bad luck here :-( Karel
* Convert inet-related functions to new fmgr style. I have also taken itTom Lane2000-08-032-214/+204
| | | | | | | | on myself to do something about the non-self-consistency of the inet comparison functions. The results are probably still semantically wrong (inet and cidr should have different comparison semantics, I think) but at least the boolean operators now agree with each other and with the sort order of indexes on inet/cidr.
* More functions updated to new fmgr style --- money, name, tid datatypes.Tom Lane2000-08-034-196/+179
| | | | | We're reaching the mopup stage here (good thing too, this is getting tedious).
* Repair bug noted by Paul Caskey: neqsel() has been generating a bogusTom Lane2000-08-031-5/+58
| | | | | | | | | result, in fact nearly the opposite of what it should, because it was passing the not-equal operator to eqsel() which would use it to compare the value against the most common value in the column, and of course obtain the wrong result therefrom. Must pass the equality operator to eqsel() instead. Fortunately that's easy to get from the oprnegate link.
* Convert all remaining float4 and float8 functions to new fmgr style.Tom Lane2000-08-016-937/+700
| | | | | | At this point I think it'd be possible to make float4 be pass-by-value without too much work --- and float8 too on machines where Datum is 8 bytes. Something to try when the mood strikes, anyway.
* Make acl-related functions safe for TOAST. Mark pg_class.relacl asTom Lane2000-07-311-83/+66
| | | | | compressible but not externally storable (since we're not sure about whether creating a toast relation for pg_class would work).
* Type lztext is toast.Tom Lane2000-07-303-494/+3
| | | | | | | (Sorry, couldn't help it...) Removed type filename as well, since it's unused and probably useless. INITDB FORCED, because pg_rewrite columns are now plain text again.
* Convert all remaining geometric operators to new fmgr style. ThisTom Lane2000-07-301-1139/+1285
| | | | | | | | allows fixing problems with operators that expected to be able to return a NULL, such as the '#' line-segment-intersection operator that tried to return NULL when the two segments don't intersect. (See, eg, bug report from 1-Nov-99 on pghackers.) Fix some other bugs in passing, such as backwards comparison in path_distance().
* PATH and POLYGON datatypes are now TOASTable. Associated functionsTom Lane2000-07-292-566/+341
| | | | | updated to new fmgr style. Deleted hoary old functions for compatibility with pre-6.1 representations of these datatypes.
* bpchar, varchar, bytea, numeric are toastable --- if you initdb, whichTom Lane2000-07-295-625/+596
| | | | | | I did not force. I marked numeric as compressable-but-not-move-off-able, partly to test that storage mode and partly because I've got doubts that numerics are large enough to need external storage.
* Add int2-vs-int8 comparison operators. These are now necessary becauseTom Lane2000-07-281-2/+116
| | | | | | | the planner may try to generate them as a result of transitivity of the existing int2-vs-int4 and int4-vs-int8 operators. In fact, it is now necessary that mergejoinable cross-datatype operators form closed sets. Add an opr_sanity regress test to detect missing operators.
* Remove <values.h> inclusions, no-longer-needed MAXINT definitions.Tom Lane2000-07-283-14/+3
|
* Ensure that values stored within arrays are not toasted, perTom Lane2000-07-271-6/+29
| | | | discussion on pghackers a few days ago.
* Further cleanup of array behavior. Slice assignments to arrays withTom Lane2000-07-231-215/+519
| | | | | | | | | | | varlena elements work now. Allow assignment to previously-nonexistent subscript position to extend array, but only for 1-D arrays and only if adjacent to existing positions (could do more if we had a way to represent nulls in arrays, but I don't want to tackle that now). Arrange for assignment of NULL to an array element in UPDATE to be a no-op, rather than setting the entire array to NULL as it used to. (Throwing an error would be a reasonable alternative, but it's never done that...) Update regress test accordingly.
* Arrays are toastable. (At least if you initdb, which I didn't force.)Tom Lane2000-07-224-1553/+330
| | | | | | | Remove a bunch of crufty code for large-object-based arrays, which is superseded by TOAST and likely hasn't worked in a long time anyway. Clean up array code a little, and in particular eliminate its habit of scribbling on the input array (ie, modifying the input tuple :-().
* Fixed memory allocation problems when compressing multi-MBJan Wieck2000-07-201-28/+35
| | | | | | | items. Lookup history is now a double linked list, used in a wrap-around style. Jan
* Revise aggregate functions per earlier discussions in pghackers.Tom Lane2000-07-175-323/+1005
| | | | | | | | | | | There's now only one transition value and transition function. NULL handling in aggregates is a lot cleaner. Also, use Numeric accumulators instead of integer accumulators for sum/avg on integer datatypes --- this avoids overflow at the cost of being a little slower. Implement VARIANCE() and STDDEV() aggregates in the standard backend. Also, enable new LIKE selectivity estimators by default. Unrelated change, but as long as I had to force initdb anyway...
* Fix indenting in prototype declarations. No functional changes.Thomas G. Lockhart2000-07-141-6/+6
|
* Repair parallel make in backend tree (and make it really parallel).Peter Eisentraut2000-07-131-11/+5
| | | | Make Gen_fmgrtab.sh reasonably robust against concurrent invocation.
* Remove a bunch of unused configure tests, in particular cases wherePeter Eisentraut2000-07-129-61/+27
| | | | | | | | | | * the result is not recorded anywhere * the result is not used anywhere * the result is only used in some places, whereas others have been getting away with it * the result is used improperly Also make command line options handling a little better (e.g., --disable-locale, while redundant, should really still *dis*able).
* First stage of reclaiming memory in executor by resetting short-termTom Lane2000-07-122-119/+124
| | | | | | memory contexts. Currently, only leaks in expressions executed as quals or projections are handled. Clean up some old dead cruft in executor while at it --- unused fields in state nodes, that sort of thing.
* oidvectortypes: use SQL type names and separate by commasPeter Eisentraut2000-07-092-66/+91
| | | | | | psql \df: use format_type and oidvectortypes map type REAL to float4, not float8 psql \dd :work around UNION bug
* Fix misuse of StrNCpy to copy and add null to non-null-terminated data.Tom Lane2000-07-074-16/+24
| | | | | | | Does not work since it fetches one byte beyond the source data, and when the phase of the moon is wrong, the source data is smack up against the end of backend memory and you get SIGSEGV. Don't laugh, this is a fix for an actual user bug report.
* - format_type function, in use by psqlPeter Eisentraut2000-07-072-2/+183
| | | | | - added bigint as synonym of int8 - set typelem of varlen non-array types to 0
* Rename cash_words_out to cash_words.Bruce Momjian2000-07-071-3/+3
|
* Correct unsafe use of strcmp(). See rant of same date posted to pghackers.Tom Lane2000-07-061-16/+16
|
* Added comments about the compression algorithm as requested by TomJan Wieck2000-07-061-4/+58
| | | | Jan
* Functions on 'text' type updated to new fmgr style. 'text' isTom Lane2000-07-0612-526/+550
| | | | now TOAST-able.