1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*--------------------------------------------------------------------
* Symbols referenced in this file:
* - namestrcpy
*--------------------------------------------------------------------
*/
/*-------------------------------------------------------------------------
*
* name.c
* Functions for the built-in type "name".
*
* name replaces char16 and is carefully implemented so that it
* is a string of physical length NAMEDATALEN.
* DO NOT use hard-coded constants anywhere
* always use NAMEDATALEN as the symbolic constant! - jolly 8/21/95
*
*
* Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* src/backend/utils/adt/name.c
*
*-------------------------------------------------------------------------
*/
/*****************************************************************************
* USER I/O ROUTINES (none) *
*****************************************************************************/
/*
* namein - converts cstring to internal representation
*
* Note:
* [Old] Currently if strlen(s) < NAMEDATALEN, the extra chars are nulls
* Now, always NULL terminated
*/
/*
* nameout - converts internal representation to cstring
*/
/*
* namerecv - converts external binary format to name
*/
/*
* namesend - converts name to binary format
*/
/*****************************************************************************
* COMPARISON/SORTING ROUTINES *
*****************************************************************************/
/*
* nameeq - returns 1 iff arguments are equal
* namene - returns 1 iff arguments are not equal
* namelt - returns 1 iff a < b
* namele - returns 1 iff a <= b
* namegt - returns 1 iff a > b
* namege - returns 1 iff a >= b
*
* Note that the use of strncmp with NAMEDATALEN limit is mostly historical;
* strcmp would do as well, because we do not allow NAME values that don't
* have a '\0' terminator. Whatever might be past the terminator is not
* considered relevant to comparisons.
*/
/*****************************************************************************
* MISCELLANEOUS PUBLIC ROUTINES *
*****************************************************************************/
void
/*
* Compare a NAME to a C string
*
* Assumes C collation always; be careful when using this for
* anything but equality checks!
*/
/*
* SQL-functions CURRENT_USER, SESSION_USER
*/
/*
* SQL-functions CURRENT_SCHEMA, CURRENT_SCHEMAS
*/
/*
* SQL-function nameconcatoid(name, oid) returns name
*
* This is used in the information_schema to produce specific_name columns,
* which are supposed to be unique per schema. We achieve that (in an ugly
* way) by appending the object's OID. The result is the same as
* ($1::text || '_' || $2::text)::name
* except that, if it would not fit in NAMEDATALEN, we make it do so by
* truncating the name input (not the oid).
*/