| 240 | |
| 241 | |
| 242 | static char* |
| 243 | make_null_val_with_blanks(char *value, int field_size) |
| 244 | { |
| 245 | char *ret; |
| 246 | char *cur; |
| 247 | int actual_size = field_size + 1; |
| 248 | int size = strlen(value); |
| 249 | |
| 250 | if ( size > field_size) |
| 251 | { |
| 252 | ereport(ERROR, |
| 253 | (errcode(ERRCODE_STRING_DATA_LENGTH_MISMATCH), |
| 254 | errmsg("the size of the null_value cannot be bigger than the field size"))); |
| 255 | } |
| 256 | |
| 257 | ret = (char*)palloc(actual_size); |
| 258 | strcpy(ret, value); |
| 259 | cur = ret + size; |
| 260 | memset(cur, ' ', actual_size - size); |
| 261 | ret[actual_size - 1] = '\0'; |
| 262 | |
| 263 | return ret; |
| 264 | } |
| 265 | |
| 266 | /* |
| 267 | * make_val_with_blanks |
no test coverage detected